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)
- creating/updating/deleting users (if you run a busy e-commerce site with a lot of orders, those orders could be creating new users and therefore causing frequent cache deletion)
- updating navigational menus
- updating theme options
- creating/updating/deleting sidebar widgets
- creating/updating/deleting categories, tags, or permalink structures
- creating/updating/deleting terms
- 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
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!