Manual:Architectural modules/Cache/fr

Responsabilités
Le module cache est chargé de fournir les techniques de mises en cache pour optimiser les performances de MediaWiki. Both object caching and web caching are supported by MediaWiki software. Object caching stores data and single objects, that are frequently requested and require resources to be generated. There are a lot of objects that MediaWiki stores in cache, some of them are presented below:


 * Utilisateur
 * Sortie de l'analyseur
 * Tableau de données de l'image (version, taille, largeur, hauteur, métadonnées etc.)
 * Wikicode après le prétraitement xml
 * Texte de la version
 * Différences des versions

Web caching allows storing of entire HTML pages. To support web caching MediaWiki provides integration with the Squid proxy server and Varnish accelerator. It notifies them, when a page should be purged from the cache and regenerated.



Informations d'implémentation


Mise en cache des objets
Main article: Manual:Object cache.

MediaWiki supports object caching storage in many places, for example, on a file system, in the database or in an external system like memcached. The storage mode is set by the global variable in the. Additionally cache type for messages and parser can be specified by setting and. The super class for all types of caching is, it provides interface for such methods as getting an item from cache, adding an item to cache, deleting it etc. All specific implementations of caching inherit from this class, as shown on figure Supported options for cache storing. Thus, for example, provides object caching using SQL database and  does so by using PHP's APC accelerator.

is the global variable for accessing the main cache. It is initialized from by calling. This initialization returns a specific object, for instance, in case the, it will return a. Further on whenever necessary every object can be stored by calling (providing key and value) and retrieved by calling  (providing key).

The key generation for saving in cache has some common rules. It always starts with the name of the database and follows by specification of the type of object that is being cached. Des exemples de telles clés sont montrés dans la table des clés de Cache. La partie terminale des clés varie. For example, for user object it will be the user's id and for file object it will be the md5 hash of its name. La génération de la clé pour le ParserOutput est expliquée dans la documentation du module Parser.

Apart from storing objects and data through 'central' caching set up by variable, MediaWiki implements itself additional types of caching. For example, or.

is used for caching of title objects and their ids, that are linked from a particular source. For example, an article would have links to other articles, used templates, categories, its talk page etc. All these links would be stored in a object and retrieved from there when needed.

implements caching of entire HTML pages on the file system. If is set to true, pages can be cached on the server and served to users when requested.

represents an object with cached contents of localization files. MediaWiki uses so called messages for any user-facing part of the interface. For instance, a message 'privacy' would have value 'Privacy policy' for English and 'Politica de proteccion de datos' for Spanish language. holds this kind of messages for loaded languages, and this way they can be easily accessed when producing the customized HTML page.



Cache du web
To provide integration with Squid or Varnish MediaWiki implements the purging notification. The class responsible for purging Squid URLs given a title (or titles) is. When an HTML page cache needs to be invalidated, an instance of is created and method  is called on it.

Vous pouvez voir un aperçu des différents types de mises en cache du module Cache sur la figure Types de cache dans MediaWiki.



Cache de l'analyseur syntaxique
See Manual:Parser cache.