2 added 818 characters in body
source | link

At the top of every page of page of my organization's site resides the current hours of operation and current "now open"/"now closed" status, using Views block and Office Hours module).

At this time of night on a Wednesday when logged in, I correctly see that the hours are reflecting tomorrow's hours and that the organization is now closed:

enter image description here

However when logged out, I see that the current day's hours (now over) and "NOW OPEN". It's six hours after closing time and the 5 minute page cache time in performance settings does not seem to be respected for anonymous page views:

enter image description here

What can I do to force an anonymous cache clear (overkill?) or invalidation of a block for anonymous users, perhaps on a schedule? I'm aware that the built-in Page Cache module may be caching full rendered pages for anonymous users while Dynamic Page Cache module makes it usable for logged in users. Shouldn't Page Cache respect the page cache maximum age set in the Performance settings page? Most people viewing the current hours at the top of every page are anonymous users.

For now I'll manually clear the cache, making the status update properly (not ideal).

UPDATE

While the website is served primarily to anonymous users, I found this helpful advise:

"Websites that serve personalized content to anonymous users (dynamic, per-session, e.g. a shopping cart) will want to disable the Internal Page Cache module. This module assumes pages are identical for all anonymous users. Those websites can still take advantage of the Dynamic Page Cache module though, or can alternatively do their personalization using JavaScript + AJAX."

This seems to have resolved immediate issues. I'll explore JavaScript + AJAX in the future. After disabling Internal Page Cache, a custom Lazy builder block + BigPipe has good potential for pages that need to change immediately with every page load.

At the top of every page of page of my organization's site resides the current hours of operation and current "now open"/"now closed" status, using Views block and Office Hours module).

At this time of night on a Wednesday when logged in, I correctly see that the hours are reflecting tomorrow's hours and that the organization is now closed:

enter image description here

However when logged out, I see that the current day's hours (now over) and "NOW OPEN". It's six hours after closing time and the 5 minute page cache time in performance settings does not seem to be respected for anonymous page views:

enter image description here

What can I do to force an anonymous cache clear (overkill?) or invalidation of a block for anonymous users, perhaps on a schedule? I'm aware that the built-in Page Cache module may be caching full rendered pages for anonymous users while Dynamic Page Cache module makes it usable for logged in users. Shouldn't Page Cache respect the page cache maximum age set in the Performance settings page? Most people viewing the current hours at the top of every page are anonymous users.

For now I'll manually clear the cache, making the status update properly (not ideal).

At the top of every page of page of my organization's site resides the current hours of operation and current "now open"/"now closed" status, using Views block and Office Hours module).

At this time of night on a Wednesday when logged in, I correctly see that the hours are reflecting tomorrow's hours and that the organization is now closed:

enter image description here

However when logged out, I see that the current day's hours (now over) and "NOW OPEN". It's six hours after closing time and the 5 minute page cache time in performance settings does not seem to be respected for anonymous page views:

enter image description here

What can I do to force an anonymous cache clear (overkill?) or invalidation of a block for anonymous users, perhaps on a schedule? I'm aware that the built-in Page Cache module may be caching full rendered pages for anonymous users while Dynamic Page Cache module makes it usable for logged in users. Shouldn't Page Cache respect the page cache maximum age set in the Performance settings page? Most people viewing the current hours at the top of every page are anonymous users.

For now I'll manually clear the cache, making the status update properly (not ideal).

UPDATE

While the website is served primarily to anonymous users, I found this helpful advise:

"Websites that serve personalized content to anonymous users (dynamic, per-session, e.g. a shopping cart) will want to disable the Internal Page Cache module. This module assumes pages are identical for all anonymous users. Those websites can still take advantage of the Dynamic Page Cache module though, or can alternatively do their personalization using JavaScript + AJAX."

This seems to have resolved immediate issues. I'll explore JavaScript + AJAX in the future. After disabling Internal Page Cache, a custom Lazy builder block + BigPipe has good potential for pages that need to change immediately with every page load.

1
source | link

Drupal 8: How do I invalidate cache for a block for anonymous users on a schedule?

At the top of every page of page of my organization's site resides the current hours of operation and current "now open"/"now closed" status, using Views block and Office Hours module).

At this time of night on a Wednesday when logged in, I correctly see that the hours are reflecting tomorrow's hours and that the organization is now closed:

enter image description here

However when logged out, I see that the current day's hours (now over) and "NOW OPEN". It's six hours after closing time and the 5 minute page cache time in performance settings does not seem to be respected for anonymous page views:

enter image description here

What can I do to force an anonymous cache clear (overkill?) or invalidation of a block for anonymous users, perhaps on a schedule? I'm aware that the built-in Page Cache module may be caching full rendered pages for anonymous users while Dynamic Page Cache module makes it usable for logged in users. Shouldn't Page Cache respect the page cache maximum age set in the Performance settings page? Most people viewing the current hours at the top of every page are anonymous users.

For now I'll manually clear the cache, making the status update properly (not ideal).