Cache

From Joomla! Documentation

Revision as of 18:11, 1 June 2015 by MATsxm (talk | contribs) (Created page with "APC par exemple met également en cache votre opcode php.")
Other languages:
Deutsch • ‎English • ‎Nederlands • ‎eesti • ‎español • ‎français • ‎italiano • ‎português • ‎русский • ‎فارسی • ‎हिन्दी • ‎中文(台灣)‎
Copyedit.png
This Article Needs Your Help

This article is tagged because it NEEDS REVIEW. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.


Joomla! propose différentes options de "mise en cache". Voici un aperçu destiné aux administrateurs et développeurs du quoi, où et quand...

Pour les administrateurs

Un administrateur Joomla! pourra utiliser les options et caches suivants :

Cache de page

  • Configuration : plugin intégré (Extensions -> Gestion des plug-ins -> Système - Cache de page)
  • Caches : chaque page de votre site
  • Basé sur : l'URL
  • Plus d'infos :
    • Option mise en cache du navigateur : également, les caches de en fonction du navigateur/ordinateur de vos visiteurs.
    • Uniquement les caches de pages pour les invités (pas pour les utilisateurs enregistrés).

Cache de vue

  • Configuration : Configuration->Cache
  • Caches : chaque vue d'un composant
  • Basé sur : URL, vue, paramètres...
  • Plus d'infos : les développeurs de composants doive,t l'inclure dans leur code. La plupart du temps ce n'est pas le cas. Le composant principal de contenu pour Joomla! l'utilise, mais seulement pour les visiteurs de votre site car il n'est pas obligatoire pour chacun des composants.

Mise en cache de modules

  • Configuration : Configuration->Cache
  • Caches : chaque module (individuellement personnalisés via les paramètres avancés de modules)
  • Basé sur : ?
  • Plus d'infos : vous devez le désactiver sur certains modules afin d'éviter certains problèmes.

Further Caching

If you want to check out other cache systems and possibilities, you might want to check out the third-party extensions around caching.

Caching engines or storages

  • Configuration: Global Config->Cache

Here you can choose which system you want your site to use for all caching. Current options are: APC, Eaccelorator, File, Memcache, XCache.

APC par exemple met également en cache votre opcode php.

For Developers

The class JCache allows a lot of different sorts and levels of caching. The following sub-classes are made specifically, but you can add your own, or use the main one in many different ways.

Don't forget that the first level of cache encountered, will override any deeper caching. I suppose that too many levels is also counterproductive (to be verified though).

  • JCacheView caches and returns the output of a given view (in MVC). A cache id is automatically generated from the URI, specific view and its specific method, or you can give your own.

Cela peut être réalisé automatiquement via la fonction d'affichage de base du contrôleur. Par exemple, dans le contrôleur de votre composant :

class DeliciousController extends JController {
	function display() {
		parent::display(true); //true asks for caching.
	}
}

There are also some urlparams to consider. Check this "joomla stack"

Also, be aware that any updates (such as hits or visit counts) will NOT be updated (unless you add this outside this method and thus any deeper MVC-part.)

  • JCachePage caches and returns the body of the page.
  • JCacheCallback caches and returns the output and results of functions or methods.

If you want to cache queries, this is a good class for it, as illustrated here: Using caching to speed up your code

  • JCacheOutput caches and returns output.

This is rather meant for caching a specific part of php code. It acts like an output buffer, but cached. <headertabs/>

Références