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 as well as related content (e.g. taxonomy archives) will be cleared and (if your settings allow) preloaded.
Full cache deletion
These WordPress actions trigger full cache deletion:
- 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
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).
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!