Jump to content

Custom module: API call to delete cache of all pages programmatically?


titanium
 Share

Recommended Posts

I have build a custom module which changes a bunch of pages at once. How can I delete the cache of all pages to be sure that all pages reflect the latest changes? I didn't found anything in the API docs.

It really depends what cache you are talking about? Template cache, Markup cache, runtime memory cache, ProCache? All of these caches usually clear themselves for the saved page, so you don't usually have to consider the cache except for pages that may be pulling pulling data from a separate cached page. 

Link to comment
Share on other sites

It really depends what cache you are talking about? Template cache, Markup cache, runtime memory cache, ProCache? All of these caches usually clear themselves for the saved page, so you don't usually have to consider the cache except for pages that may be pulling pulling data from a separate cached page. 

Thanks Ryan, I should have been more precise. I did mean template cache. Meanwhile, I found some kind of workaround. As you said, this cache gets cleared when the page is saved, therefore I wrote at the top of the template:

$page->of(false);
$page->save();
$page->of(true);

These actions just occur if a certain condition is met. I did this because I have build a contact form, which could be added with the help of Hanna Code to an otherwise cached page. I didn't want the client to select another (uncached) template if he uses this hanna code. I think it works so far.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...