How often is the cache cleared?

In this article


When does WP Rocket clear the cache?

The most common triggers for full or partial cache deletion are:

  • Cache Lifespan:
    On the Cache settings tab you can specify a Cache Lifespan. Only cache files older than the specified lifespan will be deleted. A cron job will run every hour to check which files should be deleted. 
  • New content:
    When you publish new content or update/edit existing content, the cache for that post/page, the homepage, as well as related content (e.g. taxonomy archives) will be cleared and (if your settings allow) it will be preloaded afterwards.
  • Changes to WP Rocket settings:
    When you change certain options in WP Rocket which affect the frontend of your site, such as File Optimizations, the cache will be cleared automatically.
  • For hosting/caching compatibilities: to keep the caches in sync (e.g. on WP Engine and others )

Full cache deletion

These WordPress actions trigger full cache deletion:

  • updating WP Rocket, depending on the type of changes included in the new version
  • changing/updating current themes and parent themes (of child themes)
  • updating navigational menus
  • updating theme options
  • creating/updating/deleting sidebar widgets
  • creating/updating/deleting categories, tags, or permalink structures
  • creating/updating/deleting terms registered as 'public'
  • creating/updating/deleting links (the post type “Link” that was removed from WorPress core in version 3.5, but may still be used via a plugin)
  • when any options are saved in the Customizer
  • when the Avada theme clears its own cache
  • When any snippet using the rocket_clean_domain() function is triggered, such as this cron job

Developers, you might want to look here for which WordPress actions WP Rocket hooks into for cache clearing.

Partial cache deletion

Actions that will trigger partial cache deletion:

  • creating/updating/deleting posts, pages, or public custom post types
  • creating/updating/deleting comments on a post
  • If User Cache is enabled and a user is updated or deleted, only the cache of that user will be deleted. (If you have activated the helper plugin to use the same cache for all logged-in users, these purge actions do not apply).
  • Related content: when updating a post, the homepage, the homepage feed, the next and previous post (by ID and in the same category), the posts page, the post type archive page, the author page, and all the post ancestors will be purged too. When using WooCommerce, saving a product variation will trigger the purge of the parent product.
  • When any snippet using the rocket_clean_post() function is triggered.

Disable automatic cache clearing

It is technically possible to prevent WP Rocket from clearing the cache. Here’s how:
Disable all automatic cache clearing

Heads up! Altering automated cache management can result in outdated content somewhere on your website. Proceed with caution!

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.