Skip Navigation

[Closed] Views Cache

This support ticket is created 3 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 3 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1920715

I'm trying to set a particular view to not be cached, or in the alternative, set times for the cache on it to be purged.

On the home page you see the view "Home - Outlook Bars" near the top of the page. I am having issues with the bars and days not updating correctly. Actually, the bars seem to update fine. But the dates, which are retrieved by a shortcode, do not update when they are supposed to. For instance, while I was working on it the view got cached with the center bar being labeled "Fri | Sat | Sun" and the last one reading "Mon and after." Once I got the shortcode fixed so it was delivering correct data, the labels did not update.

I can verify several ways that the view is being cached. For example, if I reload the home page the shortcode plugin does not log the request as it should -- nothing happens. I also tried the page from cURL and got the cached, not correct, output.

I purged CloudFlare cache -- that did not fix the issue. The shortcode works as expected when included in a page (hidden link) or via the Oxygen shortcode block. When I cleared the cache using the button in the views display, the view updated appropriately and logged its run as it should have.

What I'm looking for is a way to say "never cache this view" or in the alternate "clear the cache for this view at 1200 GMT daily." Does such a thing exist?

#1920755
Screen Shot 2021-01-27 at 10.50.58 AM.png

What I'm looking for is a way to say "never cache this view" or in the alternate "clear the cache for this view at 1200 GMT daily." Does such a thing exist?
Hi, you can disable the Views caching layer for any View in a few different ways. If the View is inserted in the page using a shortcode, you can add the cached="off" attribute in the shortcode:

[wpv-view name="Your view" cached="off"]

That's probably the most effective way when using Views shortcodes.

If the View is created in the Block Editor using the Toolset View block, there is a caching option in the top-level View block that will allow you to disable caching. Select the top-level View block and find that option in the General configuration panel - I've attached a screenshot of this.

Several other situations will automatically disable caching in a View, as explained here: https://toolset.com/documentation/legacy-features/views-plugin/how-to-use-views-parametric-search-on-large-sites/

There is no way built-in API to programmatically clear the View cache directly at a specific time every day, but you should be able to disable the View cache entirely using the information provided here.

The topic ‘[Closed] Views Cache’ is closed to new replies.