Takes snapshots of entire pages including everything -component, modules, plugins and a template.The widest and the least flexible approach of all cachingoptions.// enabled by core system plugin -> site administrators choice //
Takes snapshot of each unique modules set (typicaly eachpage)Affects all modules - works as layer above module cache.// enabled by setting cache level to progressive -> site administrators choice. For finegrained control over each module cache use conservative caching level. //
Most widespread cache type, sometimes equaled with Jcaching in general. Performs well in the speed terms Disables any user<->extension<->framework interaction until a cached copy has expiredNot suitable for any components or modules that react touser actions or render frequently changing content.
COMPONENT VIEW CACHETakes an array of url parameters and their types to createCacheid.A replacement for a previous unsafe way which took thewhole URL and so opened the doors for DOS attacks viarandom parameters/values added to request// Old cacheid created from URL retained for backwards compatibility if there are no$safeurlparams (to be removed in 1.7) //
MODULE CACHE5 different modes of operation, 3 of them are to be setfrom module XML file, while 2 are meant to be used fromwithin the module itself.Default is backwards compatible oldstatic mode thatrequires no changes to a module.
MODES TO BE SET IN XMLStatic - one cache file for all pages with the same moduleparameters.Recommended for modules that dont change.Oldstatic - 1.5. definition of module caching, one cachefile for all pages with the same module id and user aid.Default for backwards compatibility
MODES TO BE SET IN XMLItemid - changes on itemid change.Suitable for most dynamic modules that change per page- like menus, breadcrumbs, content images etc
In addition to cache field that was required in 1.5 there isnow new hidden field in module XML called cachemodethat sets any of the above modes.<field name="cachemode"type="hidden"default="static"><option value="static"></option></field>
MODES TO BE CALLED FROM INSIDE THE MODULE:Safeuri - id is created from URL params array, as incomponent view cacheUse this mode if you module depends on url parametersother than Itemid to display content (e.g. module thatdisplay different image for each content category).Modeparams property is an array of url parameters andtheir filter types
MODES TO BE CALLED FROM INSIDE THE MODULE:Id - module sets own cache ids according to its ownformula.Most flexible, but not needed often.Modeparams property is calculated id.
To use this modes rename cache field in xml toowncache field and call JModuleHelper::ModuleCache from withinthe modules main php file.// actually a shortcut to cache callback to avoid code duplication in every module //
An example that uses safeuri mode$list = modRelatedItemsHelper::getList($params) :$cacheparams->modeparams = array(id=>int,Itemid=>int);$cacheparams->methodparams = $params;$cacheparams->method = getList;$cacheparams->class = modRelatedItemsHelper;$cacheparams->cachemode = safeuri;$cacheparams = new stdClass;$list = JModuleHelper::ModuleCache ($module, $params, $cacheparams);
The first of flexible caching types that enable us todifferentiate between various parts of the extension andcache only those parts that are cacheable, while keepingdynamic parts uncached.
Caches results of function callsRecords (cacheID) based on the arguments passed to thefunction
Often useful to cache model methods and keep viewsuncached.Example useModel performing expensive queries or similar operationsis run only once to create a larger pool of data which isthen further manipulated inside the view (sorting,pagination, calculations etc.)
Caches any data unitsRecords based on id passed
Fully controlled by the coder – what, when to store, howto classify stored units (cache id).Highly useful when we are dealing with finite number ofreusable data units
Example useHigh number of possible combinations of relatively smallnumber of units – e.g. products in online store. No pointto cache multiple parameter searches, cache each productseparately.Other examplesExpensive queries, remote XML, thumbnails, reusabletexts or any reusable data set.
Also useful to pass large amounts of data betweendifferent parts of application (e.g. steps in click flow)Used in Joomla core: list of components, list of modules,menu tree, available languages, user groups, htmlrenderers etc.
Raw cache get and store are easily accesed by passing (empty string) as cache controller to JFactory::getCacheData is auto serialized / deserializedLocking & unlocking are performed automaticaly