Skip to content

Clear all caches

Clear the page cache, the object cache, PHP's code cache, and the edge cache in one click, from WordPress, the dashboard, WP-CLI, or the API.

Parts of this feature are still being built. The Not yet section lists them.

Avaloi keeps four caches for each environment. Clear all caches empties all four in one step:

  • Page cache. Whole pages the server keeps for visitors who are not logged in.
  • Object cache. The Redis cache of the object cache add-on, when the site has it. Each environment has its own Redis, so this touches no other site.
  • PHP code cache. PHP's compiled code (OPcache). On live, code is a read-only release, so this is the only code cache there is.
  • Edge cache. Cloudflare's copies of your pages and files, for every domain of this environment.

Clearing a cache never deletes content, settings, users, or orders. Transients are only gone when the object cache held them, which is where WordPress keeps them when the object cache add-on is on. Pages and objects rebuild on the next visit.

From WordPress

Users who can manage options (administrators) see Clear caches in the admin bar, in wp-admin and on the front end of the site.

  • Click Clear caches itself, or Clear all caches in its menu, to clear all four.
  • Clear page cache, Clear object cache, and Clear edge cache clear one at a time.

When it is done, the page you were on shows what happened, for example: "Cleared: page cache, object cache, PHP code cache, edge cache (takes up to a minute to spread)." If a cache could not be cleared, the note says which one and why, and the others still clear. For example, a site without the object cache add-on shows "Skipped the object cache: this site has no object cache, so nothing was stored there."

Tools > Avaloi Cache has the same four buttons, the server cache status, the last purge, and the last clear from WordPress.

Why the edge cache takes up to a minute

WordPress never holds your Cloudflare credentials. The plugin asks the Avaloi agent on your server, and Avaloi picks the request up within 30 seconds and clears Cloudflare for every domain of the environment. The request is checked against a secret only your site and its server know.

You can ask for the edge cache once every 10 seconds. A second click sooner says "Already clearing the edge cache. Try again in a few seconds." Each edge clear from WordPress is in User activity as "Cleared all caches from WordPress" with the email of the WordPress user who asked, and in the purge history on Caching.

From the dashboard and AI agents

Caching > Clear all caches in the dashboard clears the same four caches, and so does the clear_cache tool for AI agents when you give it no paths. Both run one job, and the finished job says what it cleared. With paths, clear_cache clears only those pages from the server cache.

From WP-CLI

wp avaloi cache clear            # all caches
wp avaloi cache clear --page
wp avaloi cache clear --object --edge

WP-CLI runs outside the web server's PHP, so it cannot reset PHP's code cache. wp avaloi cache clear says so and clears the other three. Use the admin bar or the dashboard when you also need PHP's code cache reset. The command is allowed in the dashboard's WP-CLI tool and through the API.

Limits

  • Edge cache from WordPress: one request every 10 seconds per environment.
  • The edge cache spreads within about a minute of a click in WordPress, and within seconds from the dashboard.

Not yet

  • A server that runs an Avaloi agent from before this feature does not answer the edge request yet. WordPress then clears the other caches and says "Skipped the edge cache: the Avaloi agent on this server did not answer, and it may need an update." Use Clear all caches in the dashboard until the server is updated.
  • Clearing the cache of another caching plugin is not part of Clear all caches. Avaloi blocks page cache plugins that fight the server cache.

API

  • POST /v1/environments/{id}/cache/purge with {"scope": "all"} clears all four caches. The job result lists them in cleared.
  • POST /v1/environments/{id}/tools/cache/clear clears the server caches (page, object, and PHP code) without Cloudflare, or only the paths you list.

Still stuck?

Email [email protected] with your site name and what you tried, or send us a message.