BzZzZ - ustvarjamo podobe logo
Joomla 1.6 caching demystified (Jennifer series)

Tried to make this so easy than every Jennifer/Joe could understand it. ..Probably that's impossible - but the rest of you should be fine.


Joomla 1.6.  makes heavy use of caching and to be able to use it's full potential we must first understand how caching works. As caching was almost completely redone for  1.6. (mostly by the author of this article), some older descriptions and typologies don't apply any more.


Cache - temporary store an unit of information to be reused later.


Mostly because retrieving stored information is MUCH (up to 10 times or more) faster than initial generation. If you need a drastic example - a book is long term cache of it's authors knowledge. It could take years to accumulate this knowledge, while reading from this cache is a much faster thing as we all know.

But back to Joomla - more specifically, what we are dealing with here is web application caching - creating temporary static copies of otherwise dynamic pages (or smaller data units). Caching is particularly appropriate for web applications  as typical web site displays  the same content over and over again and without cache everything has to be generated for each and every page view. Caching system temporary stores this information generated by the code in a cache object and serves it when it is requested by the next user.


To understand Joomla cache a little deeper we must get familiar with two concepts - cache types and cache handlers.For easier understanding take a look at pictures that illustrate each cache type coverage area.






Takes snapshots of entire pages including everything - component, modules, plugins and a template. It is the fastest, the widest and the least flexible approach of all caching options. To activate it one must enable core system plugin and so it's usage is site administrators choice.



Takes snapshot of each unique modules set (typically each page). Affects all modules - works as layer above module cache and stores a set of modules in rendered state.

It is enabled by setting cache level to progressive, also a site administrators choice. If you need fine grained control over each module cache, use conservative caching level which disables this caching layer (you get the same behaviour as in 1.5.).



They form a group as they they both create a static copy of complete output of a component or a module. This are most widespread cache types, sometimes equaled with Joomla caching in general.

It's positive side is that it performs well in the speed terms, but on a negative side disables any user<->extension<->framework interaction until a cached copy has expired. That means it is not suitable for any components or modules that react to user actions or render frequently changing content.

As cached copy includes only modules or components own output ,  any external file that is called by using methods like $document->addStyleSheet() won't get included. To come around this limitation we have implemented numerous workarounds, but they represent a kind of catch22 situation - workarounds require computing resources and so diminish the effect of caching.

This kind of cache must be implemented by extension developers.



The first of flexible caching types that enable us to differentiate between various parts of the extension and cache only those parts that are cacheable, while keeping dynamic parts uncached. It caches results of function calls in code.



Caches output of some part of the script. It is basically output buffering with caching and is not used often.



Caches any data units. Fully controlled by the coder - what, when to store, how to classify stored units (cache id). Highly useful when we are dealing with finite number of reusable data units.

This type is used in Joomla core to cache framework operations: list of components, list of modules, menu tree, available languages, user groups, html renderers etc.




Caching types work like non-transparent layers on top of each other (except module/component view cache that work in parallel). To understand it we must imagine that we we are viewing a web page from above and page cache represents the top layer, while function/output/raw cache represent the bottom layer. What happens is that each higher layer covers those laying bellow. So generally when using page cache all other caches are not relevant - with one exception - a situation when we are using different lifetimes for different cache type. E.g. we might cache rendered page views for a short time and cache images for a very long time - in this case most times view is rendered it pulls images from image cache.





Cache handler are heavy workers. They are the ones that do the dirty job and store information on chosen media. To be able to use cache we must have at least on cache handler available.

By default Joomla uses File cache handler, which uses files to store information. File cache works reliably but it it relatively slow compared to memory based handlers.If file cache is not available you must fix your cache folder permissions so that web server can write in it. If you don't know how  to do that ask you hosting provider.

In Joomla 1.6. there are 7 different handlers: File cache and Cache lite handlers that use files for storage and APC, Eaccelerator, Memcached, Xcache and Wincache that use memory. To use any but File cache, you need to have appropriate php extension installed. To use Memcached you would also need at least one memcached server running.

Note - some of those extensions are not compatible, to be on the safe side use only one memory based cache at the time.

  • strateško usmerjeno
  • integrirano
  • s kreativnostjo pospešeno
  • učinkovito komuniciranje
© BzZzZ 2008
stik z nami    zaposlitev    kazalo strani