Cache and Invalidation
The Cache Layers
ReactWP uses several independent cache layers. Clearing one does not automatically clear every other one.
| Layer | Scope | What it stores | How it changes |
|---|---|---|---|
| Route memory | current browser tab | normalized route payloads already fetched | full page reload |
| Cache Storage | browser profile | same-origin JSON and media responses | ReactWP cache generation |
| HTTP browser cache | browser profile | JS, CSS, fonts, images | asset URL/version and response headers |
| Static fragment store | deployment and WordPress uploads | generated route HTML | dependency tags, SSG, runtime regeneration |
| SSR fragment cache | WordPress object cache/transients | optional request-rendered HTML | TTL, user scope, dependency tags |
| Host or CDN cache | infrastructure-dependent | HTML and static responses | provider purge or deployment rule |
Brotli and gzip are transfer encodings, not separate application caches. Their .br and .gz files are server-side representations of the original asset URL.
Cache Generation
WordPress stores the ReactWP cache generation in rwp_client_cache_version. It is exposed as:
runtime.system.cacheVersion
The browser uses it in names such as:
rwp-cache-json-<generation>
rwp-cache-media-<generation>
On a full page load, ReactWP opens the active generation and deletes older managed generations. Same-origin media requests also receive an rwp-cache-version query value, and initial JavaScript/CSS versions include the generation.
The generation therefore invalidates ReactWP-managed JSON, media, JavaScript, CSS references, and pre-rendered HTML together. It is not public-only: the global invalidation also expires static fragments and cached SSR HTML in both public and private scopes.
Invalidate from WordPress
Open the admin bar and choose:
ReactWP > Cache
The Cache item appears immediately after Plugins for users who can manage options. The page displays the current generation and provides a nonce-protected invalidation action.
Static fragments and cached SSR entries, including per-user private entries, become stale immediately on the server. Existing visitors receive the new browser generation on their next full page load. A server cannot synchronously erase Cache Storage inside a tab that is already open on a remote device.
PHP API
Read the current generation:
$version = rwp::client_cache_version();
Advance it:
$version = rwp::bust_client_cache();
Invalidate only selected static/SSR dependencies:
rwp::invalidate_render_cache([
'post-type:project',
'settings:all',
]);
ReactWP fires an action after the value changes:
add_action('rwp_client_cache_busted', function($version){
// Purge a CDN or notify deployment infrastructure.
});
Use that action to connect provider-specific purges. ReactWP cannot know which CDN or host cache a project uses.
Browser Console Cleanup
For debugging one browser, inspect the actual names first:
await caches.keys()
Then remove all ReactWP generations:
const names = await caches.keys();
await Promise.all(
names
.filter((name) => name.startsWith('rwp-cache-json-') || name.startsWith('rwp-cache-media-'))
.map((name) => caches.delete(name))
);
location.reload();
Older unversioned projects may contain rwp-cache-json and rwp-cache-media. Deleting those exact names is only useful for that older runtime.
Chrome can block pasted console code until the user types allow pasting. That protection belongs to DevTools and is not a ReactWP error.
Publishing Content vs Publishing Code
The route memory cache can keep a previously visited payload for the lifetime of an already-open tab. If an editor changes content, a full reload gets the fresh bootstrap and starts a new runtime session.
For a deployment that changes code or globally visible content:
- deploy the complete production output
- purge HTML at the host or CDN if applicable
- invalidate ReactWP > Cache
- test from a new private window
Do not use random query strings on every request. Stable versioning preserves useful caching while still giving releases a controlled invalidation point.
Static fragments are checked against their dependency invalidation timestamps before every use. When Node is configured, affected routes are queued for regeneration. Without Node, ReactWP serves the current client route instead of stale generated HTML. See Hybrid Rendering.
For the complete list of automatic tags, custom tag syntax, dynamic dependencies, invalidation hooks, and debugging workflow, see Cache Tags.