Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124

When we talk about joomla caching we are referring to the practice of storing a copy of generated content so that the server does not have to rebuild it on every request. Joomla’s core provides several layers of cache, each designed to cut down on database queries, PHP processing, and network traffic. By enabling the right cache options we can keep the site fast for visitors while reducing the load on the hosting environment. In addition, a well‑tuned cache reduces the number of times the same PHP code runs, which can lower the risk of race conditions on busy sites and improve overall site security and make debugging easier because the same output is reproduced consistently.
Caching works by reusing data that has already been computed. For a typical Joomla page the system may need to load modules, run component logic, and fetch rows from the database. When a cache entry exists, Joomla can skip those steps and serve the stored HTML directly. This means fewer MySQL queries, less PHP execution time, and lower CPU usage. Over time the reduction in server load translates into lower hosting costs and a smaller chance of time‑outs during traffic spikes.
For example, a news article page that normally triggers three separate database queries—one for the article content, one for the author profile, and one for related tags—can be reduced to a single file read when cached. On a server that handles 5,000 requests per hour, this change can cut the number of database calls from 15,000 to just a few hundred, freeing resources for other visitors.
Static content such as images, CSS, and JavaScript files are naturally cache‑friendly; browsers and CDNs already keep them for a long time. Dynamic content – the HTML generated by Joomla components, modules, and menus – changes more often, but it can still be cached for short periods. Understanding which parts of a page are truly dynamic helps us decide where to apply page cache, module caching, or view caching without breaking functionality.
In practice we often separate the “shell” of a page (header, footer, navigation) from the “body” that contains the article or product list. The shell can be cached for many minutes because it rarely changes, while the body may need a shorter lifetime or even be left uncached if it displays user‑specific information such as a shopping cart.
Google’s Core Web Vitals (Largest Contentful Paint, First Input Delay, Cumulative Layout Shift) are heavily influenced by how quickly a page can be delivered. By serving cached HTML we lower the Time to First Byte (TTFB), which in turn improves LCP and Speed Index. A well‑tuned cache configuration can push a site from “needs improvement” to “good” in the performance reports, while also keeping the user experience smooth on mobile devices.
Tools such as PageSpeed Insights or WebPageTest make us see the difference directly. A page that originally recorded an LCP of 3.2 seconds may drop to 1.8 seconds after enabling page caching, moving it into the “good” range. Likewise, a reduction in server processing time often eliminates noticeable input lag, improving the First Input Delay metric.
The first place we look for cache options is the Global Configuration screen. The official Joomla documentation on caching provides a detailed reference for each setting. Here Joomla offers two main strategies – conservative and progressive – plus a cache lifetime that determines how long a cached file lives before it is regenerated. These settings are applied sitewide, but we can override them on a per‑module or per‑component basis if needed.
Conservative caching stores a copy of the page for a fixed period, ignoring any changes that might have occurred in modules or menus during that time. It is safe for sites where content updates are infrequent or where we can tolerate a short delay before new changes appear to visitors. The cache lifetime is set in minutes; a typical value is 15‑30 minutes.
Because the cached version is served without checking timestamps, the server can skip a large part of the PHP execution chain. This approach works well for brochure sites, documentation portals, or landing pages that are updated only when a new version is published.
Progressive caching is more flexible. Joomla checks the timestamp of each module and component before serving a cached page. If any part has been updated, the cache entry is regenerated on the fly. This approach reduces the risk of serving stale content, but it adds a small amount of processing overhead because the system must compare timestamps.
In practice the overhead is usually negligible on modern hardware, but on very high‑traffic sites it can become noticeable. We therefore recommend enabling progressive caching only when the content changes often enough to justify the extra checks.
We decide based on the frequency of content changes and the server’s capacity. For a brochure site that rarely changes, conservative caching gives the best speed boost. For an e‑commerce store or a news portal where articles appear constantly, progressive caching prevents outdated information from being shown. In practice we start with conservative, monitor the cache hit ratio, and switch to progressive if we notice stale pages.
Monitoring can be done with Joomla’s built‑in debug console or with external tools like New Relic. A hit ratio above 80 % usually indicates that the current strategy is effective, while a drop below 50 % suggests that the cache lifetime may be too short or that progressive checks are needed.
The cache time, also called cache lifetime, is defined in minutes under System > Global Configuration > System. A value that is too low defeats the purpose of caching, while a value that is too high can keep old data visible for too long. A good rule of thumb is to match the cache time to the publishing schedule of the site – for example, 10 minutes for a site that publishes new articles every hour, or 60 minutes for a corporate site that updates only once a day.
We also consider peak traffic periods. During a marketing campaign we might temporarily lower the cache time to ensure that promotional banners are refreshed quickly, then raise it again once the campaign ends.
Beyond the global settings, Joomla provides a dedicated plugin called System – Page Cache. This plugin creates a full‑page HTML snapshot and stores it in the cache directory. When a visitor requests the same URL, Joomla serves the snapshot directly, bypassing most of the PHP execution chain.
The plugin can be enabled per site or per language, allowing us to keep a cached version for the English version of a site while leaving the French version uncached if it contains more personalized content.
When the plugin is enabled, Joomla captures the output buffer after the page has been rendered. It then writes the buffer to a file whose name is derived from the request URL and the language. On subsequent requests, the plugin checks if a valid cache file exists; if it does, Joomla reads the file and sends it to the browser without invoking the component or module code.
The file name includes a hash of the query string, which ensures that URLs with different parameters (such as pagination) receive separate cache files. The files are stored under cache/page by can be inspected directly on the server for troubleshooting.
Page caching shines on high‑traffic pages that do not contain personalized data – for example, a homepage, a static “About Us” page, or a product listing that is the same for all users. It can hurt on pages that rely on user‑specific information such as login status, cart contents, or dynamic forms. In those cases we should either disable the plugin for those URLs or use module caching instead.
Modules that display a “Welcome, John” greeting or a “Your cart has 3 items” notice must be excluded from page caching. Joomla lets us add URL patterns to the plugin’s exclusion list, or we can set the module’s “Cache” parameter to “No” so that it is always rendered dynamically.
Browser caching is controlled through HTTP headers that tell the visitor’s browser how long to keep static assets. Joomla’s System – Page Cache plugin can add Cache‑Control and Expires headers for the HTML output. We can also set the Expires header for CSS and JavaScript by editing the htaccess.txt file and adding rules such as:
# Enable browser caching for static assets
ExpiresActive On
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 year"
After updating the .htaccess file we can verify the headers with the browser’s developer tools. The “Network” tab shows the “Cache‑Control” and “Expires” values for each request, confirming that the browser will keep the files locally for the intended duration.
Joomla stores cached data using a cache handler. The default handler writes files to the cache directory, but for larger sites we can switch to an in‑memory system such as Memcached or Redis. These handlers keep data in RAM, delivering faster read/write speeds compared to disk.
Choosing the right handler depends on the hosting environment, the expected traffic, and the budget. In many cases a hybrid approach—using the file handler for infrequently accessed data and Redis for high‑frequency page cache—provides a good balance between simplicity and performance.
The file handler creates a folder structure under /cache and writes serialized PHP data to files. It is simple to set up and works on any shared hosting environment. However, on a busy site the file system can become a bottleneck, especially when many concurrent requests try to read or write the same cache files.
We should ensure that the cache directory is writable by the web server user and that the file permissions are set to 755 or 775 depending on the host. Regularly checking the directory size helps us avoid runaway growth; a cron job can delete files older than the cache lifetime as an extra safety net.
To use Memcached we first install the PHP extension memcached on the server. Then we edit configuration.php and set the following values:
// configuration.php
public $cache_handler = 'memcached';
public $memcached_persist = 1;
public $memcached_compress = 0;
public $cache_time = 15; // minutes
After saving the file we enable the cache in Global Configuration. Joomla will now store page and module cache entries in the Memcached daemon, which can handle thousands of operations per second.
We can test the connection by creating a simple PHP script that calls memcached->set() and memcached->get(). If the script returns the expected value, the handler is correctly configured.
Redis offers similar speed to Memcached but adds features such as persistence and richer data structures. To enable Redis we install the php‑redis extension and then modify configuration.php:
// configuration.php
public $cache_handler = 'redis';
public $redis_server_host = '127.0.0.1';
public $redis_server_port = 6379;
public $cache_time = 10; // minutes
Redis can also be used for session storage, which further reduces database load. When we combine Redis with Joomla’s built‑in cache, we often see TTFB drop by 30‑40 % on a medium‑size site.
Because Redis can persist data to disk, we have the option to survive a server restart without losing cached pages. This is useful for sites that experience frequent deployments, as the cache can be restored automatically after a reboot.
Our recommendation depends on the hosting environment. If we are on a shared plan with only file access, the file handler is the only option. On a VPS or dedicated server where we can install additional services, Memcached is a solid choice for pure speed. Redis is preferable when we need both cache and session handling, or when we plan to use advanced features like pub/sub for real‑time updates.
Cost is another factor. Memcached and Redis both require additional memory, so we should allocate enough RAM to avoid swapping. A typical rule of thumb is to reserve at least 256 MB for the cache daemon on a small site and scale up to several gigabytes for high‑traffic portals.
Beyond Joomla’s core cache we can add external layers that operate before the request reaches PHP. These solutions often provide edge‑side includes (ESI), automatic image optimization, and integration with CDNs.
Choosing a third‑party solution depends on the server stack and the desired level of control. Some plugins are tightly coupled to a specific web server, while others work with any Apache or Nginx installation.
The LiteSpeed Cache plugin works only on servers that run the LiteSpeed web server. It creates a static HTML copy of each page and stores it in the server’s fast storage. The plugin also supports ESI, allowing us to keep dynamic blocks such as login forms uncached while the rest of the page is served from cache.
Configuration is straightforward: after installing the plugin we enable it, set the cache TTL, and optionally define a list of URLs to exclude. The plugin automatically clears the cache when we publish a new article, thanks to Joomla’s built‑in event system.
Varnish sits in front of the web server and caches HTTP responses in memory. To make Joomla Varnish‑friendly we need to send proper Cache‑Control headers and avoid caching pages that contain personalized data. A typical Varnish configuration includes a VCL rule that bypasses the cache for URLs containing task=login or option=com_user.
Here is a simple VCL snippet that demonstrates the exclusion logic:
sub vcl_recv {
if (req.url ~ "task=login" || req.url ~ "option=com_user") {
return (pass);
}
return (hash);
}
After adding the rule we purge Varnish’s cache whenever Joomla clears its own cache, using a small script that calls the purge endpoint.
Cloudflare provides a global network of edge servers that cache static assets and, with the “Cache‑Everything” setting, can also cache HTML pages. When we enable Cloudflare’s page rule to cache HTML, we must ensure that Joomla’s System – Page Cache plugin is also active, otherwise the CDN may serve outdated content. Cloudflare’s automatic cache purge API can be called from Joomla after a new article is published, keeping the edge cache fresh.
We typically configure a page rule that matches example.com/* and sets “Cache Level: Cache Everything” together with a “Edge Cache TTL” of 30 minutes. This combination gives us a fast first‑byte response while still allowing Joomla to purge the edge cache when needed.
Even with the best configuration, cache entries can become stale or cause unexpected behavior. Joomla offers several ways to purge the cache manually or automatically.
We go to System > Clear Cache for select the cache groups we want to delete, then click “Delete”. For a full purge we also use System > Purge Expired Cache. This removes any files whose lifetime has elapsed, freeing up disk space and ensuring that the next request generates fresh content.
It is often useful to clear only specific groups, such as “com_content” when we have updated an article, rather than wiping the entire cache. This targeted approach reduces the impact on users who are currently browsing other parts of the site.
We can schedule a cron job that runs the Joomla CLI command php cli/cache.php --purge every hour. Alternatively, we can enable the “Cache Expiration” option in Global Configuration, which tells Joomla to automatically delete expired entries each time a page is rendered. For Redis or Memcached we can set a maxmemory-policy such as volatile‑lru so that the server evicts the least‑recently‑used keys when memory is full.
Automated cleanup helps us avoid the situation where old cache files accumulate and fill up the disk, which could otherwise cause server errors or slow down the file‑based handler.
Typical problems include stale pages, missing modules, or “404 Not Found” errors after a cache purge. The first step is to check the cache directory permissions – Joomla must be able to read and write files. If we see blank pages, we should disable the System – Page Cache plugin temporarily to verify that the issue is not caused by a third‑party extension. Logging the cache handler’s debug output (via System > Global Configuration > Debug System) can also reveal why a particular entry is not being served.
Another useful technique is to enable Joomla’s “Debug System” and look at the “Cache” tab in the debug output. This tab shows which parts of the page were served from cache and which were generated fresh, helping us pinpoint the source of a problem.
The cache time, also called cache lifetime, is the number of minutes Joomla keeps a cached file before it is considered expired. It can be set in System > Global Configuration > System under “Cache Time”. Typical values range from 5 minutes for very dynamic sites to 60 minutes for static corporate sites.
No. Caching is a temporary storage mechanism designed for fast retrieval, while storing usually refers to permanent data kept in a database or file system. Cache entries are automatically removed after their lifetime expires or when we manually purge them.
Pressing Ctrl+Shift+R (or Cmd+Shift+R on macOS) forces the browser to reload the page and bypass its own local cache. It does not clear Joomla’s server‑side cache. To clear Joomla’s cache we must use the admin interface or run a purge command.
Joomla allows only one cache handler to be active at a time. We can, however, use Redis for session storage while keeping Memcached for page cache, but this requires custom code or a third‑party plugin that supports separate handlers.
We should disable caching during major site updates, when troubleshooting layout issues, or on pages that rely heavily on user‑specific data such as shopping carts. Disabling caching temporarily helps us see changes instantly and ensures that no stale HTML is served to customers.
Enabling caching on a development site can be useful for testing performance, but it may also hide problems that only appear when the cache is cleared. We typically keep caching turned off while we are actively developing new features, and enable it briefly to verify that the production configuration works as expected.
Page cache stores a complete HTML snapshot of the entire page, including header, footer, and all modules. When a request matches a cached page, Joomla serves the snapshot without executing any PHP code. Module cache, on the other hand, stores the output of individual modules only. The rest of the page is still generated dynamically, but the cached module output is inserted where needed. Module cache is useful when only a few parts of a page are static, while the rest must remain dynamic.