Cache is incomplete, cleared too frequently or randomly

Sometimes, you might notice the cache is being cleared randomly, without a clear explanation. Some symptoms of this could be: 

  • The cache folder is incomplete.
  • There is a random number of cached pages.
  • You experience a sudden slowness of some pages.
  • There are too many rocket_preload_job_preload_url entries in the Action Scheduler actions table.

In normal circumstances, WP Rocket will clear the cache as described in this doc: How often is the cache cleared, and if enabled, the Preload should be triggered too.

If you notice the cache is cleared inconsistently, please keep reading to find potential causes and solutions.

Third party plugins

Many plugins interact with cache plugins like WP Rocket, clearing the cached files under some circumstances to prevent issues with outdated contents. 

This can happen, for example, when you make changes to your website. Plugins can use our function: rocket_clean_domain() to delete the whole cache. 

Known plugins that might be clearing your cache:


Known issues

We have also discovered that the cache can be unexpectedly cleared in some specific cases:


Troubleshooting

You can install this plugin helper, it will create logs with useful information to determine if your theme or plugin is clearing the cache too frequently. 

📥   Download (.zip):  WP Rocket | Logging Cache Clearing
Developers: You can find the code for this plugin on GitHub.

The files 01-full-cache-clear.txt, 02-partial-cache-clear.txt and 03-rocket_clean_files_log.txt are created in the WordPress installation directory.

If you need help interpreting the information, please open a support ticket and send us the log files. Please, note that after installing the helper, you will need to wait for the cache clear logs to be registered. 

To discover if the cache clearing is triggered by one of your plugins or by your theme, you can install a plugin like String Locator, and search for rocket_clean_domain() to see if that function is being used somewhere.

Possible solutions

It can be hard to "fix" this, but you can take actions to mitigate the effects of unexpected cache clearing:

  • Deactivate plugins: If you have plugins that are clearing the cache and these are not important for your project.
  • Theme: If you discover your theme is clearing the cache, ask the theme developer to see if it is really needed.
  • Enable Preload: Ensure WP Rocket's Preload is enabled.
  • Server-side Cron Job: Set up a server-side cron job to have a more reliable preloading.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.