Pantheon Community

Problems with caching of views block on home page

Is there a way to easily use tag caching (or some other method?) to make sure that a views block is showing fresh filtered data? We have a view block on our home page ( https://zoo.sandiegozoo.org ) that shows the current date’s hours, but even though we have installed the Pantheon Advanced Page Cache module, it seems, intermittently, to not catch the content differences. Is this because the content is not stored in that node, but rather as part of a view block placed on the page?

I looked up custom tag caching, and even the Views Custom Cache Tags module, but all the info I have found requires (or the instructions given seem to be written for) building a custom module… Can anyone tell me how to make sure that the block cache is refreshed every day? Thank you!

What is the cache setting on the view block itself in the views interface?
Are the hours stored in the node or something else?
If you’d like we can schedule a zoom call I can help to debug. Please let me know.

Amy -

We have Caching set to “None” for every display in that view. The hours are attached to nodes, one per day. I would love any help you can give… We had to clear cache to get today’s hours to show correctly this morning - this morning was the first time closing hours changed in a while.

I am able to jump on a screenshare to check your setup and see if there is anything I can help with. Please let me know what times work for you. I am usually available after 5 EST. Meanwhile I’ll setup sandbox similar to your setup and test on Pantheon.

I am definitely available after 5est… What is the best way to set this up?

Please send me direct message with your email address and I’ll send you a meeting invite for the zoom screenshare.

1 Like

This is silly, but I am having problems finding a way to direct message on here…

If you do get an answer to your problem, would you mind posting it here? I’m curious about this as well. Thanks!

I researched a bit and it looked like that was a CDN caching issue. Pantheon documentation recommends to try out these 2 modules for more granular control:
https://www.drupal.org/project/views_custom_cache_tag
https://www.drupal.org/project/cache_control_override
We haven’t tested those yet, for this specific use case we decided to try and force refresh through views with the randomizer sort. It seemed like a quick and easy way to solve it. But if you have more development resources / time I’d definitely go the route of exploring the modules. The key is that the cache tags are not being passed to indicate refresh so views custom cache tag should take care of the problem.

Anna -

Sorry I fell off the radar. Thank you again for all your help with this!

Turns out that the randomization of the view didn’t work if you were not logged in/if you were anonymous.

I have installed but not activated views_custom_cache_tag, as it is far more involved and I am not sure I completely understand.

I am going to give cache_control_override a shot, since it looks like all you have to do is install it.

Thank you again for everything!

Kristin,
No worries, please let me know if you need any more help with configuring the module I will be happy to help.