X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcache%2FBacklinkCache.php;h=c04a22ac80b6a3f6f0debd2841ea8d21de18dc0e;hb=e1ebc2de02efbaf9183a48359b0025b04de9c5e4;hp=3ba4f6140fb752db2359a0857ecfe9e1d936f119;hpb=e9faefa60edf102b3dcf87cbdd0dfd9b52451a44;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/BacklinkCache.php b/includes/cache/BacklinkCache.php index 3ba4f6140f..c04a22ac80 100644 --- a/includes/cache/BacklinkCache.php +++ b/includes/cache/BacklinkCache.php @@ -40,8 +40,8 @@ * Introduced by r47317 */ class BacklinkCache { - /** @var ProcessCacheLRU */ - protected static $cache; + /** @var BacklinkCache */ + protected static $instance; /** * Multi dimensions array representing batches. Keys are: @@ -53,6 +53,7 @@ class BacklinkCache { * @see BacklinkCache::partitionResult() * * Cleared with BacklinkCache::clear() + * @var array[] */ protected $partitionCache = array(); @@ -62,6 +63,7 @@ class BacklinkCache { * * Initialized with BacklinkCache::getLinks() * Cleared with BacklinkCache::clear() + * @var ResultWrapper[] */ protected $fullResultCache = array(); @@ -99,15 +101,10 @@ class BacklinkCache { * @return BacklinkCache */ public static function get( Title $title ) { - if ( !self::$cache ) { // init cache - self::$cache = new ProcessCacheLRU( 1 ); + if ( !self::$instance || !self::$instance->title->equals( $title ) ) { + self::$instance = new self( $title ); } - $dbKey = $title->getPrefixedDBkey(); - if ( !self::$cache->has( $dbKey, 'obj', 3600 ) ) { - self::$cache->set( $dbKey, 'obj', new self( $title ) ); - } - - return self::$cache->get( $dbKey, 'obj' ); + return self::$instance; } /**