0

I have nodes updating from my module in Drupal 7 and also complicated view with result cached in the module by cache_set() and cache_get() functions.

Anonymous users get old info with broken links and other problems after nodes updating in module. Disabling "Cache pages for anonymous users" solves the problem, but how can I update anonymous page cache by the function after update?

I can't just clear all cache because of complicated views cache, it will disable all site for the time.

1

cache_clear_all() is what you need.

If you need to clear cache of only one node page:

cache_clear_all('http://yoursite.com/node/' . $node->nid, 'cache_page')

(first parameter - cache id, it case of cache_page it is page url).

If you want to clear all pages cache:

cache_clear_all('*', 'cache_page', TRUE);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.