The problem: is this page cached or not?
A page feels slow, or an edit has not appeared, and the question is always the same: did that response come from the cache? Guessing from load time is unreliable. A fast uncached page and a slow cached one both exist.
Every decent page cache tells you in the response headers. Ask for the headers only:
curl -sI https://example.com/ | grep -i -E 'x-ace|cache-control|age'
-I asks for headers without the body, and -s hides the progress output. With Ace Redis Cache the line that matters is X-AceRedisCache. Other caches use other names for the same three answers.
The three answers
| Answer | Meaning | Is it a problem? |
|---|---|---|
HIT | A stored copy was sent | No. This is the goal |
MISS | Nothing usable was stored, so WordPress built the page | Only if it keeps happening on the same URL |
BYPASS | The cache chose not to be involved in this request | Only if you expected the request to be cacheable |
The difference between the last two matters. A MISS is the cache trying and finding nothing. A BYPASS is the cache deciding this request is not its business, usually for a good reason.
Reading a HIT
ARC has several kinds of hit:
| Value | Meaning |
|---|---|
HIT | Served from the page cache by the plugin, after WordPress loaded |
HIT-COMPRESSED | The same, sent as the stored compressed copy |
HIT (advcache) | Served by the drop-in before WordPress loaded |
HIT (advcache, stale) | A stale copy, served at once. Its refresh has been queued |
A stale hit is not a fault. It means a visitor got an instant answer while the new copy was built in the background. I explain why that is the better trade in serve the stale page while you rebuild it.
| Age of the stored page | Header | What the visitor gets |
|---|---|---|
| Under 1 hour | HIT | The stored page, at once |
| 1 to 2 hours | HIT (advcache, stale) | The old page at once, and one refresh is queued in the background |
| Over 2 hours | MISS | A wait while WordPress builds the page, which is then stored again |
Reading a MISS
A bare MISS means the page was rendered and stored. The next request should be a hit. Run the command again:
MISS, thenHIT. Working as intended. You were the first visitor after an expiry or an edit.MISS, thenMISS. The page is being built and then refused. Look for a reason.
A MISS with a reason means the page was rendered and not stored:
| Reason | Meaning |
|---|---|
first_view | With the transient cache off, a page is stored on its second view |
empty_main, empty_body | The content did not render, so a broken page was not kept |
is_404, status_not_200 | Not a successful page |
is_search, is_feed | Not stored by design |
protected_post | A password-protected or unpublished post |
host_mismatch | The request came in on an address that is not the site's own |
The "refused" cases are the cache protecting you. Storing an empty page or an error and serving it to everyone for an hour is far worse than one slow view.
Reading a BYPASS
| Reason | Meaning | What to do |
|---|---|---|
logged_in | You are signed in | Test signed out, in a private window or with curl |
cookie | A basket, session, comment author or protected post cookie | Expected. If every visitor has one, find what sets it too early |
query_string | A parameter that changes the response | Expected for basket actions. Tracking parameters such as utm_source do not cause this |
excluded_path | Basket, checkout, account, or a path the site excludes | Check your exclusion list if it is a surprise |
method | Not a GET request | Expected |
preview | A preview or the Customizer | Expected |
private_response | The response says private, no-store or no-cache | Find the plugin sending that header |
donotcachepage | Something defined DONOTCACHEPAGE | Search your plugins and theme for that constant |
warming | The short pause after a post is saved | Wait a few seconds and ask again |
redis_unavailable | Redis could not be reached | See what happens when Redis goes down |
outage_recovery | An invalidation was missed while Redis was away, so stored pages are being cleared first | It resolves on its own once the clear has run |
The most common surprise is logged_in. If you are checking the site in the browser you edit it with, you are not seeing what visitors see.
Five mistakes when reading cache headers
- Testing while signed in. Use curl or a private window.
- Testing once. One
MISStells you nothing. Ask twice. - Reading through another cache. A CDN or proxy in front stores the headers along with the page, so the
MISSyou see may be days old. Ask the origin directly. Varnish in front of a WordPress page cache shows how. - Forgetting the mobile copy. If the site stores separate desktop and mobile pages, check both:
curl -sI -A 'Mozilla/5.0 (iPhone)' https://example.com/ - Trusting speed alone. A stale page is fast. Check the content changed, not only that the response was quick.
A routine for "my edit is not showing"
- Ask for the page signed out, twice, and note the header.
- If it is a
HIT, add?aceredis_nocache=1to the address. That request skips the cache. If the edit shows there, the stored copy is old. - Check whether another layer sits in front. If so, repeat step 1 against the origin.
- Save the post again and ask once more after a few seconds. A
stalehit followed by a freshHITmeans the refresh ran. - If the stored copy never updates, the edit is not reaching the cache. That is common with content changed by an import or directly in the database, which fires no save event. Refresh those pages from your import with
aceredis_refresh_urls().
More detail when you need it
Turn on the extra headers in the plugin's settings to see the age of a stored copy, how long it has left, how it is compressed and how many live blocks the page holds. Pages with cached blocks also report each one as hit, miss, skip or live, in X-Ace-Block-Cache.
If you would sooner not expose reasons publicly:
add_filter( 'aceredis_expose_bypass_reason', '__return_false' );
The complete list is on the response headers wiki page, and troubleshooting walks through the common cases.
Checklist
- Ask with curl, signed out, twice.
HITis the goal, and a staleHITis fine.MISSthenHITis normal.MISSthenMISSneeds its reason read.BYPASSnearly always has a good reason. Read it before changing anything.- Read headers at the origin when another cache sits in front.
New to the two layers? Start with page cache and object cache, then how ARC serves a request. If the page should be cacheable and something personal is stopping it, see cache the page, not the visitor. When you are ready to try it, get the plugin or read the changelog.