From: Timo Tijhof Date: Mon, 9 Nov 2015 23:51:11 +0000 (+0000) Subject: BacklinkCache: Remove use of ProcessCacheLRU X-Git-Tag: 1.31.0-rc.0~9045^2 X-Git-Url: http://git.cyclocoop.org//%22%22.str_replace%28%27%22%27%2C?a=commitdiff_plain;h=e6205019a484d56dade617ce26331b3ca4d12242;p=lhc%2Fweb%2Fwiklou.git BacklinkCache: Remove use of ProcessCacheLRU Follows-up af89b09a06 and e40a90f0bc, and general phasing out of MapCacheLRU and ProcessCacheLRU. Use of ProcessCacheLRU seems redundant in this case as it is essentially just a keyed singleton. Change-Id: I7cc84cf6c76ecc422ea337dba2d216c3d7ebf281 --- diff --git a/includes/cache/BacklinkCache.php b/includes/cache/BacklinkCache.php index 1323c70a3e..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: @@ -101,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; } /**