Files

46 lines
3.4 KiB
Markdown
Executable File

# Caching
**Dotjuice → Page speed → Caching**
## What this tab controls
Full-page HTML caching: whether pages are cached at all, whether mobile and desktop get separate cached copies, whether logged-in visitors are included, and how long a cached page stays valid before it's rebuilt.
## Settings
| Setting | Default | What it does |
|---|---|---|
| **Enable Page Caching** | On | Turns full-page caching on or off entirely. With this off, every other setting on this tab has no effect. |
| **Separate Cache for Mobile Devices** | On | Stores a distinct cached copy for mobile visitors, detected by user agent. Keeps this on if your theme shows different content or layout on mobile — otherwise mobile visitors could occasionally be served a desktop-cached page or vice versa. |
| **Cache Pages for Logged-in Users** | Off | See the warning below — this doesn't do what the label suggests. |
| **Cache Lifetime (seconds)** | 86400 (24 hours) | How long a cached page is considered fresh before it's automatically rebuilt. Minimum 300 seconds (5 minutes), maximum 30 days. |
## How caching stays up to date
You never need to manually clear the cache after normal editing. It happens automatically when you:
- Publish or update any post or page (only that page and your homepage are cleared — the rest of your cached site is untouched)
- Switch themes
- Update a plugin or WordPress core
The **Cache Lifetime** setting is a safety net on top of this — a maximum age for any cached page, in case something changes the page without triggering a normal WordPress save (a scheduled event, an external data feed, etc.).
## ⚠ About "Cache Pages for Logged-in Users"
This setting is easy to misread. WordPress admin/editor sessions are excluded from the fastest cache delivery paths regardless of this setting — that part is fixed and can't be turned off, which is exactly what you want (you should always see a live, uncached view of your own site while logged in).
What this toggle actually does is let a logged-in visit *contribute* to building the cache that anonymous visitors later see, on the rare occasions a logged-in request reaches a page that isn't already cached. **We recommend leaving this off** unless you have a specific reason to change it: if you're logged in as an editor or admin and your theme shows you anything personalised (an admin bar styling quirk, a "welcome back" message, draft content preview, etc.), enabling this risks that content being saved into the cache and shown to anonymous visitors afterward.
## Manually clearing the cache
Two ways to force every cached page to rebuild immediately:
- **Clear Cache** button in the Page speed settings toolbar
- **Clear Cache** button in your WordPress admin bar (visible on every page, front-end and admin) — this one also shows your current cache size and clears the combined CSS/JS files from the [CSS](css-optimisation.md) and [JavaScript](javascript-optimisation.md) tabs at the same time
Use this after making a change that automatic clearing wouldn't catch — a manual template edit, a change made outside the normal post/page editor, or simply to confirm you're looking at a fresh copy of a page while troubleshooting.
## For the fastest possible caching
See [Getting Started](getting-started.md) for the one-time `WP_CACHE` setup step — it enables the fastest of three delivery methods this plugin uses. Caching still works without it, just not at its absolute fastest.