MediaWiki master
MediaWiki\Cache\CacheKeyHelper Class Reference

Helper class for mapping value objects representing basic entities to cache keys. More...

Static Public Member Functions

static getKeyForPage ( $page)
 

Detailed Description

Helper class for mapping value objects representing basic entities to cache keys.

Rationale: The logic for deriving the cache key should not be in the value object themselves for two reasons: Firstly, the value object should not contain knowledge about caching or keys in general. Secondly, all implementations of a given interface must have the exact same logic for deriving the cache key. Otherwise, caches will break when different implementations are used when interacting with a cache.

Furthermore, the logic for deriving cache keys should not be in a service instance: there can only ever be one implementation, it must not depend on configuration, and it should never change.

Definition at line 43 of file CacheKeyHelper.php.

Member Function Documentation

◆ getKeyForPage()

static MediaWiki\Cache\CacheKeyHelper::getKeyForPage ( $page)
static
Parameters
LinkTarget | PageReference$page
Returns
string

Definition at line 59 of file CacheKeyHelper.php.

Referenced by MediaWiki\Cache\LinkBatch\addResultToCache().


The documentation for this class was generated from the following file: