Cache in Joomla
Caching is the single biggest speed lever in Joomla, and the one most people misunderstand. Turn it on and your pages can load several times faster. Turn it on carelessly and visitors start seeing yesterday's content, a logged-in name in someone else's header, or a shopping cart that never updates. The component that gives you control over all of this is called com_cache.
Most administrators meet com_cache only as the Clear Cache button they press when something looks stale. But the component is the visible tip of a much larger system: cache levels, cache handlers, a page-cache plugin, per-module caching, and a developer API that any extension can use.
The small backend tool that clears Joomla's cache, sitting on top of a caching system that decides how fast your whole site feels.
This article explains how Joomla caching really works. It covers the basics for owners and editors, the daily settings for administrators, and the technical details for developers: where cached data lives, which handler stores it, how the API works, and why caching and logged-in users do not always mix.
1. The Basics
1.1 What is com_cache?
A Joomla component is a small application that runs inside Joomla. Most components are about something: com_content is about articles, com_users is about users. com_cache is about cached data - the temporary copies Joomla keeps so it does not have to rebuild every page from scratch on every visit.
The component itself is tiny. It has one job split in two: it lets you clear the cache (delete the stored copies) and purge expired cache (delete only the copies that are past their use-by time). It does not create the cache - the rest of Joomla does that. com_cache is the housekeeping screen.
1.2 What is a Cache, Really?
A cache is a saved answer. The first time a visitor opens a page, Joomla runs the full work: it queries the database, builds the articles, renders the modules, and assembles the HTML. With caching on, Joomla also saves a copy of the result. The next visitor who asks for the same page gets the saved copy back, skipping most of the work.
Caching trades freshness for speed: you serve a slightly older copy so you can serve it much faster.
That trade-off is the whole story. Everything else in this article is about controlling how old the copy may get and which parts of the site are allowed to be served from a copy.
1.3 Why It Matters
Caching touches the two things every site owner cares about:
- Speed. A cached page skips database queries and rendering. On a busy site this is the difference between a snappy page and a slow one.
- Server load. Fewer queries per visit means the server handles far more visitors before it struggles.
The cost is staleness. If you publish a new article and the home page is cached for 15 minutes, the new article may not appear for up to 15 minutes. Knowing how to clear the cache - and how long it lasts - is part of running a Joomla site well.
1.4 Where to Find It
In the Joomla 6 backend there are two entry points, both under the System menu:
System -> Maintenance -> Clear Cache
System -> Maintenance -> Clear Expired Cache
Both open the same component, com_cache, in two different views. The settings that decide how caching behaves live elsewhere, in Global Configuration (section 6).
2. The Two Jobs of the Cache Component
2.1 Clear Cache
The Clear Cache screen lists every cache group that currently holds data, with the number of files and the total size:
| Column | Meaning |
|---|---|
| Cache Group | The name of the group, usually a component, e.g. com_content. |
| Number of Files | How many cached items the group holds. |
| Size | How much disk (or memory) the group uses. |
You can tick one or more groups and press Delete, or press Delete All to wipe everything. Clearing a group removes all its items, fresh or not. This is the button to use after a theme change, a template update, or any time the site shows something you know you already changed.
2.2 Clear Expired Cache
The Clear Expired Cache screen (the model calls it purge) is gentler. It removes only the items whose cache time has already passed. Items still inside their lifetime stay. This is safe to run at any moment because it never throws away a copy that Joomla would still serve.
Expired items are not removed the instant they expire. They sit on disk until something deletes them: a purge, a full clear, or a fresh request that overwrites them. On a long-running site the cache folder can fill with thousands of expired files. A scheduled purge keeps it tidy.
2.3 Clear vs Purge - Which to Use
| Action | Removes | Use when |
|---|---|---|
| Clear Cache (one group) | Everything in that group | One component shows stale content. |
| Clear Cache (Delete All) | Everything, every group | After updates, template or override changes, debugging. |
| Clear Expired Cache | Only items past their cache time | Routine cleanup; safe housekeeping. |
3. How Joomla Caching Works
3.1 The Cache Lifecycle
Every cached item follows the same simple cycle:
1. Request comes in.
2. Joomla builds a cache ID for it (a hash of the relevant inputs).
3. Is there a stored item for that ID, and is it still inside its cache time?
YES -> return the stored copy. Done. (a cache "hit")
NO -> do the real work, store the result, return it. (a cache "miss")
The cache ID is the key idea. Joomla builds it from the things that should make the output different - the option, the view, the Item ID, the language, the user's access groups, and so on. Two requests with the same inputs get the same ID and therefore the same copy.
3.2 Cache Groups
Items are organised into groups, almost always named after the component that created them: com_content, com_modules, com_plugins, plus a few internal ones like _system and com_templates. The group is what you see and tick on the Clear Cache screen. Grouping means you can clear one component's cache without touching the rest.
3.3 Where the Cache Lives
With the default File handler, cached items are plain files in two folders:
cache/ (the site / frontend cache)
administrator/cache/ (the backend cache)
Inside, each group gets its own subfolder, and each item is a .php file whose name is the cache ID. The file starts with a die line so it cannot be read directly through the web. You can safely delete the contents of these folders by hand if the backend is unreachable - it is the same as a full Clear Cache.
3.4 Which Tables Feed the Cache
A point that surprises developers: com_cache has no database table of its own. The cache is files or memory, never rows. What it stores, though, is the rendered result of ordinary queries. When a view or page is cached, it is built from content tables such as:
#__content Articles
#__categories Categories
#__modules Module content and page assignments
#__menu Menu items (drive the cache ID via Itemid)
#__extensions Component and plugin settings
#__session Login state (decides guest vs logged-in caching)
The cache layer sits between these tables and the response: on a hit, Joomla skips the queries against them entirely.
Back to top4. Caching Levels: Off, Conservative, Progressive
Global Configuration offers three caching levels. They map to the values 0, 1, and 2 of the caching setting.
4.1 Off (0)
No view or module caching. Joomla rebuilds everything on every request. This is the right setting while you develop or debug, and the wrong one for a busy production site.
4.2 Conservative (1)
The recommended default. Joomla caches the output of component views and modules, keyed carefully so that different pages and different access levels get different copies. It is "conservative" because the cache ID includes enough context to avoid serving one page's content on another. This is the safe choice for almost every site.
4.3 Progressive (2)
Progressive caching is more aggressive: it caches module output more broadly and reuses it across pages. On paper it is faster. In practice it is the classic cause of "the wrong module shows up on the wrong page", because a module that should change per page gets served from a single cached copy. Avoid Progressive unless you have tested it carefully and your modules truly are identical everywhere.
Back to topRule of thumb: start with Conservative. Reach for Progressive only when you have measured a real need and confirmed nothing breaks.
5. Cache Handlers: Where Items Are Stored
The cache handler decides the storage medium. Joomla 6 ships four:
| Handler | Stores in | Good for |
|---|---|---|
file |
Files in cache/ |
The default. Works everywhere, no extra software. |
apcu |
PHP shared memory (APCu) | A single server; very fast for small items. |
memcached |
A Memcached server | Multiple web nodes sharing one cache. |
redis |
A Redis server | Multiple nodes; persistence and richer features. |
Older Joomla versions also offered XCache, eAccelerator, WinCache, and a plain database handler. These are gone in modern Joomla - do not expect them.
5.1 Choosing a Handler
- File is fine for most small and medium sites. Its only real weakness is many small files on slow disks.
- APCu is the easy win on a single server: it keeps items in memory, so there is no disk I/O. It does not survive a PHP restart and is not shared between servers.
- Memcached or Redis are the right answer for load-balanced clusters, because every web node reads and writes the same shared cache. Redis adds optional persistence and is the common modern choice.
5.2 Platform Specific Caching
The Platform Specific Caching option (the cache_platformprefix setting) adds the browser/device type to the cache ID. Turn it on only if you serve genuinely different HTML to desktop and mobile from the same URL. For a responsive template that sends the same HTML to every device, leave it off - turning it on simply doubles the number of cached copies for no benefit.
6. Global Configuration Cache Settings
All the levers live at System -> Global Configuration -> System -> Cache Settings. They are stored in configuration.php (not the database), so a developer can read them directly.
| Field | Key | Meaning |
|---|---|---|
| System Cache | caching |
0 Off, 1 Conservative, 2 Progressive. |
| Cache Handler | cache_handler |
file, apcu, memcached, or redis. |
| Platform Specific Caching | cache_platformprefix |
Add device type to the cache ID. |
| Cache Time | cachetime |
How long an item stays fresh, in minutes (default 15). |
| Path to Cache Folder | cache_path |
Optional custom path; blank means the default cache/. |
6.1 Cache Time Is in Minutes
The default Cache Time is 15 minutes. After that, an item counts as expired and the next request rebuilds it. Lower it (for example to 5) if your content changes often and a short delay matters; raise it (for example to 60) for a mostly static brochure site where speed matters more than freshness.
6.2 Caching On Does Not Mean Pages Are Cached
This surprises people: switching System Cache to Conservative caches component views and modules, but it does not, on its own, cache the whole HTML page. Full-page caching is a separate feature, the System Page Cache plugin, covered next. The two are often used together.
Back to top7. The Page Cache Plugin
7.1 What It Does
The System - Page Cache plugin (plg_system_cache) caches the entire rendered HTML page. When it scores a hit, Joomla returns the stored page almost before the application fully boots - this is the fastest cache Joomla has.
Enable it at System -> Manage -> Plugins, search for System - Page Cache, and turn it on. It uses the same handler and cache time as the global settings.
7.2 Guests Only
The most important rule: the page cache only serves logged-out (guest) visitors. The moment a user logs in, the plugin steps aside and serves them a freshly built page. This is deliberate - a full-page cache cannot safely share one stored page between a guest and a logged-in user, or between two different logged-in users, because the page contains personal details such as their name or cart.
7.3 The Plugin Options
| Option | What it controls |
|---|---|
| Use Browser Caching | Sends cache headers so the browser can reuse the page and Joomla can answer with a 304 "Not Modified". Powerful but blunt - use with care. |
| Excluded Menu Items | Menu items that must never be page-cached (for example a contact form). |
| Exclude URLs | A list of URL patterns to skip. Use this for dynamic pages. |
Use Browser Caching deserves a warning: once a visitor's browser holds the page, your server cannot tell it to refresh until the time runs out. Leave it off unless you understand the consequence.
7.4 What to Exclude
Always exclude pages that must be live or personal: contact forms, search results, login and registration, carts and checkouts, and any page with a per-visitor token. Page-caching those leads to submitted forms that "do nothing" or stale tokens that fail security checks.
Back to top8. Module Caching
8.1 Per-Module Control
Each module has its own caching settings on its Advanced tab:
- Caching - Use Global (follow the global setting) or No Caching (never cache this module).
- Cache Time - an optional per-module lifetime that overrides the global cache time.
Set a module to No Caching when its content must always be live: a "logged in as" greeting, a random quote, a live counter, or anything that should differ on every view. Leave the rest on Use Global.
8.2 The Module Cache Mode
Behind the scenes a module can register a cache mode that tells Joomla what makes its output unique. The common modes are:
| Mode | One cached copy per... |
|---|---|
static |
Module (same output everywhere). |
itemid |
Menu item (output changes per page). |
safeuri |
A chosen set of URL parameters. |
id |
A custom key the module supplies. |
This is why a poorly written module can show the same content on every page even with caching configured "correctly": it declared static when it should vary by menu item. The setting is in the module's code, not the backend.
9. Under the Hood: The Caching API
Caching is available to any extension through a small, consistent API. There are four cache controllers, each suited to a different kind of data.
| Controller | Caches |
|---|---|
output |
A block of generated HTML or text. |
callback |
The return value of a function or method. |
view |
The full output of an MVC view. |
page |
A whole page (used by the page cache plugin). |
9.1 The Callback Cache (Most Useful)
The callback controller is the everyday tool. You hand it a function and its arguments; it runs the function on a miss, stores the result, and returns the stored value on a hit. The modern way to get a controller is through the cache controller factory:
use Joomla\CMS\Cache\CacheControllerFactoryInterface;
use Joomla\CMS\Factory;
$cache = Factory::getContainer()
->get(CacheControllerFactoryInterface::class)
->createCacheController('callback', ['defaultgroup' => 'com_myext']);
$data = $cache->get(
function ($id) {
// Expensive work runs only on a cache miss.
return MyHelper::loadExpensiveData($id);
},
[42], // arguments passed to the callback
'item-42' // an optional cache ID
);
The older shortcut still works and is common in existing code:
use Joomla\CMS\Factory;
$cache = Factory::getCache('com_myext', 'callback');
$data = $cache->get([MyHelper::class, 'loadExpensiveData'], [42]);
9.2 The Output Cache
When you have already built a string of HTML and just want to store it:
$cache = Factory::getCache('com_myext', 'output');
$id = 'sidebar-' . $itemId;
if ($html = $cache->get($id)) {
echo $html; // cache hit
} else {
$html = buildSidebar($itemId);
$cache->store($html, $id);
echo $html; // cache miss, now stored
}
9.3 Pick a Good Cache ID and Group
Two rules keep cached data correct:
- Put everything that changes the result into the cache ID (the item id, the language, the user's access level if relevant). Forget one, and you serve the wrong copy.
- Use your component name as the group so administrators can clear your cache on its own from the Clear Cache screen.
10. Cleaning the Cache in Code
10.1 The onContentCleanCache Event
When content changes - an article is saved, a module is edited - Joomla fires onContentCleanCache so related caches can be flushed. Core models call this automatically after a save, which is why editing an article usually clears the stale page without you pressing anything.
In your own model you can trigger the same cleanup by calling the inherited cleanCache() method, naming the group to clear:
// Inside a model that extends Joomla's BaseDatabaseModel
$this->cleanCache('com_myext');
A subscriber can also listen for the event to clear an extra group of its own:
use Joomla\CMS\Event\Model\AfterCleanCacheEvent;
public function onContentCleanCache(AfterCleanCacheEvent $event): void
{
// Flush a related cache when core content changes.
}
10.2 The onAfterPurge Event
When an administrator runs Clear Expired Cache, the component fires onAfterPurge (event class Joomla\CMS\Event\Cache\AfterPurgeEvent). Use it for an audit trail, or to purge a custom store of your own at the same time.
10.3 Clearing the Cache from the CLI
Joomla's console application can clear the cache without a browser, which is ideal for deploy scripts and cron:
# Clear the whole cache
php cli/joomla.php cache:clean
# Clear only expired items (the purge action)
php cli/joomla.php cache:clean expired
Run a full cache:clean as the last step of every deployment so visitors never see a mix of old and new files.
11. Caching, Logged-in Users, and Personalisation
The hardest part of caching is keeping personal content private. Joomla handles this in two layers.
11.1 The Access Level Is in the Cache ID
Conservative caching includes the user's view access levels in the cache ID. A guest and a registered user therefore get different cached copies of a view, so a guest never receives content meant only for members. This is automatic and correct as long as your own code follows the same rule when it builds a cache ID.
11.2 The Page Cache Stays Away from Logged-in Users
As section 7 explained, full-page caching only ever serves guests. This is the simplest safe policy: anything personal happens on a freshly built page. The trade-off is that logged-in users get less benefit from caching - which is usually fine, since most traffic on a public site is anonymous.
11.3 The Classic Personalisation Bug
The number-one caching bug is a personal value baked into a shared cache: a "Welcome, Peter" greeting cached and shown to everyone, or a per-user token cached into a form. The fix is always one of three things: set that module to No Caching, exclude that page from the page cache, or add the user id to the cache ID so each user gets their own copy.
Back to top12. Web Services, Headless, and Clusters
12.1 No REST Endpoint for the Cache
Unlike content components, com_cache deliberately does not expose a Web Services route under /api/index.php/v1/. Clearing a site's cache is a maintenance action, not data to read or write through a public API. To automate it, use the CLI command from section 10.3 inside your own deploy or cron job.
12.2 Caching on a Load-balanced Cluster
The File and APCu handlers store the cache on the server that created it. On a cluster with several web nodes, that means each node has its own copy, and clearing the cache on one node does not clear it on the others. The fix is a shared handler - Memcached or Redis - so every node reads and writes the same cache and a single clear affects all of them.
12.3 A CDN Is Another Cache
If a CDN or reverse proxy (Cloudflare, Varnish, NGINX) sits in front of Joomla, it caches pages too - a layer Joomla cannot see or clear. When content looks stale after you have cleared Joomla's cache, remember the CDN: you may need to purge it as well. Layered caches are common, and each layer must be cleared in turn.
Back to top13. SEO and Performance
Caching is one of the most direct SEO levers you have, because page speed is a ranking and user-experience factor.
13.1 Speed and Core Web Vitals
A cached page reaches the visitor faster, which improves Time To First Byte and helps the Core Web Vitals that search engines watch. For a content site with many guests, the page cache plugin plus Conservative caching is the cheapest meaningful speed gain available.
13.2 Do Not Cache Yourself Out of Fresh Content
Long cache times help speed but hurt freshness. A news site that caches for 60 minutes may show old headlines to search-engine crawlers and visitors alike. Match the cache time to how often your content really changes, and clear the cache after publishing something time-sensitive.
13.3 Caching Does Not Replace the Basics
Caching makes Joomla return the page faster, but it does not shrink oversized images, remove render-blocking scripts, or fix a slow template. Treat caching as one part of a performance plan, not the whole of it.
13.4 Cache Warming
The first visitor after a cache clear pays the full cost of rebuilding every page - a cold cache means a slow first hit and, on a busy site, a spike in server load. Large sites avoid this with cache warming: pre-generating the cache before real visitors arrive, usually as the last step of a deployment.
Deploy finishes
|
Warm-up script requests the key pages
|
Joomla renders each page and stores it
|
First real visitor gets a cache hit
A simple warm-up is a script that requests your most important URLs - the home page, the top categories, the busiest articles - so each one is cached before traffic arrives. Pair it with the deploy-time cache:clean from section 10.3: clear first, then warm, so visitors never meet a half-old site or a cold cache.
14. Common Mistakes and Pitfalls
14.1 Changes Do Not Appear
Symptom: You edited an article, a module, or a template, but the site still shows the old version.
Fix: Clear the cache at System -> Maintenance -> Clear Cache (Delete All). If it returns after a while, your cache time is simply doing its job - lower it or clear after each change. Remember a CDN may be caching too.
14.2 The Wrong Module on the Wrong Page
Symptom: A module shows content meant for a different page.
Fix: You are likely on Progressive caching. Switch System Cache to Conservative, clear the cache, and check again.
14.3 A Personal Greeting Shown to Everyone
Symptom: Visitors see another user's name, or a logged-in greeting while logged out.
Fix: Set the personalised module to No Caching on its Advanced tab, and exclude personalised pages from the page cache plugin.
14.4 Forms and Logins Stop Working
Symptom: A contact form, login, or checkout submits and nothing happens, or you get a token error.
Fix: The page cache served a stale page with an old security token. Add those menu items to Excluded Menu Items or the Exclude URLs list in the page cache plugin.
14.5 The Cache Folder Grows Forever
Symptom: cache/ fills with thousands of old files and uses a lot of disk.
Fix: Expired items are not deleted automatically. Schedule cache:clean expired (or run Clear Expired Cache) regularly, or move to an in-memory handler such as Redis.
14.6 Cache "On" but the Site Is Still Slow
Symptom: You turned on System Cache but pages are no faster.
Fix: System Cache alone does not cache whole pages. Enable the System - Page Cache plugin as well, and check the slow pages are not personalised (and therefore never cached).
14.7 Quick Diagnostic Checks
When caching misbehaves, a few fast checks narrow down the layer at fault:
- Is it the browser, not Joomla? Force a fresh copy with
Ctrl+F5(a hard refresh) or open the page in a private window. If it looks correct there, the stale copy was in the visitor's own browser - often a side effect of Use Browser Caching in the page cache plugin. - Is Redis actually up? If you chose the Redis handler, confirm the server answers:
Noredis-cli ping --> PONGPONGmeans Redis is unreachable, and Joomla cannot store anything in it. - Are cache files appearing? With the File handler, watch
cache/andadministrator/cache/. New files on each page load mean caching is working; an empty folder means nothing is being stored.
15. Best Practices
If you remember only a few things from this article, remember these:
- Use Conservative caching on production; avoid Progressive unless you have tested it.
- Add the System - Page Cache plugin for a real speed gain - it only ever serves guests, which keeps it safe.
- Set personalised modules to No Caching, and exclude forms, logins, and carts from the page cache.
- Match Cache Time to how often your content changes; lower it for news, raise it for brochure sites.
- Clear the whole cache as the last step of every update or deployment, with the button or
cache:clean. - On a cluster, use Redis or Memcached so all nodes share one cache.
- Schedule Clear Expired Cache so the cache folder does not grow without limit.
- When developers cache their own data, put every varying input in the cache ID and use the component name as the group.
16. Quick Reference
CLEAR ALL CACHE System -> Maintenance -> Clear Cache -> Delete All
CLEAR ONE GROUP System -> Maintenance -> Clear Cache -> tick group -> Delete
CLEAR EXPIRED System -> Maintenance -> Clear Expired Cache
SETTINGS System -> Global Configuration -> System -> Cache Settings
PAGE CACHE System -> Manage -> Plugins -> System - Page Cache
CACHING LEVELS 0 Off 1 Conservative (use this) 2 Progressive (risky)
HANDLERS file (default), apcu, memcached, redis
CACHE TIME cachetime, in MINUTES (default 15)
CACHE FOLDERS cache/ and administrator/cache/
CLI
Clear all php cli/joomla.php cache:clean
Clear expired php cli/joomla.php cache:clean expired
CODE
Callback cache Factory::getCache('com_x', 'callback')->get($fn, $args, $id)
Output cache Factory::getCache('com_x', 'output')->store($html, $id)
Clean a group $this->cleanCache('com_x') (inside a model)
Events onContentCleanCache (AfterCleanCacheEvent)
onAfterPurge (AfterPurgeEvent)
Back to top17. Summary
Joomla's cache system is the fastest way to make a site feel quick, and com_cache is the small screen that keeps it under control:
com_cachedoes two things: Clear Cache (delete stored copies) and Clear Expired Cache (delete only stale ones).- The behaviour is set in Global Configuration: the caching level, the handler, the cache time, and the path.
- Conservative caching is the safe default; Progressive trades safety for speed and often breaks modules.
- The handler chooses the storage: File by default, APCu for one fast server, Redis or Memcached for a cluster.
- The Page Cache plugin caches whole pages for guests only - the biggest single speed win, with exclusions for forms and personal pages.
- Developers cache their own data through the
callbackandoutputcontrollers, and clear it withcleanCache()or theonContentCleanCacheevent.
Once you see caching as a set of layers - view cache, module cache, page cache, and maybe a CDN on top - the strange "stale content" problems stop being mysterious. Each layer has a copy, and each layer has a way to clear it. If your site is slow, or shows content you know you already changed, the cause is almost always one of these layers, and knowing how Joomla caches is the quickest way to find it and tune it safely.
Back to top

Joomla specialist and Linux admin for fast, secure and scalable websites.


