Setting Cache Lifetime (TTL)
The cache lifetime decides how long a saved page stays valid before xSpeed Cache builds it again. This guide explains the Cache Expiry (hours) setting.
What this does
Every cached page has an age. When a page is older than the cache lifetime, xSpeed Cache treats it as expired. The next visitor gets a freshly built page, which then becomes the new cached copy.
This is a time-based limit. It works alongside automatic purges, which clear the cache when you publish a post, save settings, or switch themes.
Why use it
- A shorter lifetime means visitors see content changes sooner, but the cache regenerates more often.
- A longer lifetime means fewer rebuilds and lower server load, but pages can stay older for longer.
Settings explained
| Setting | What it does | Default |
|---|---|---|
| Cache Expiry (hours) | How long cached pages live before regenerating | 24 |
Cache Expiry (hours) accepts a whole number from 1 to 720 hours. 720 hours is 30 days.
- The default of
24hours suits most sites. - Lower the value (for example to
1or6) if your content changes often during the day and you want visitors to see updates sooner. - Raise the value if your content rarely changes and you want to rebuild pages as little as possible.
Note: Publishing a post or changing settings purges the whole cache right away. So even with a long lifetime, your latest published content still goes live immediately. The lifetime mainly controls how long untouched pages stay cached.
How to set it up
- Open the xSpeed Cache Cache page in your WordPress admin.
- Find the Cache Expiry (hours) field.
- Enter a number between
1and720. - Save your settings.
Saving cache settings purges the existing cache so the new lifetime applies cleanly.
Best practices
- Start with the default of
24hours and adjust only if you have a reason to. - A news or deals site that updates many times a day may prefer a shorter lifetime.
- A brochure or portfolio site that rarely changes can use a long lifetime.
FAQ
What is the longest lifetime I can set? 720 hours, which is 30 days.
What is the shortest? 1 hour.
Do I lose the cache when I change this setting? Yes. Saving cache settings purges the cache, so pages rebuild fresh under the new lifetime.
Related
- How to Enable Page Cache
- Excluding Pages, URLs, and Cookies from Cache
- Separate Mobile Cache