From b1d215726e199139abb4320719e7bc6c03825432 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 5 Sep 2014 13:33:10 -0700 Subject: [PATCH] Removed LCStoreAccel class * Since individual message keys can expire, this can cause broken messages when such a key is needed (the message is treated as if it did not exist). The base class clearly documents a need for more atomicity (only top level keys can fall it separately). Change-Id: I992bba77a0afdeeeade8be013708277b79f22314 --- includes/AutoLoader.php | 1 - includes/cache/LocalisationCache.php | 55 +--------------------------- 2 files changed, 1 insertion(+), 55 deletions(-) diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 0559a8ef8a..1f8b483f34 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -338,7 +338,6 @@ $wgAutoloadLocalClasses = array( 'HTMLFileCache' => 'includes/cache/HTMLFileCache.php', 'ICacheHelper' => 'includes/cache/CacheHelper.php', 'LCStore' => 'includes/cache/LocalisationCache.php', - 'LCStoreAccel' => 'includes/cache/LocalisationCache.php', 'LCStoreCDB' => 'includes/cache/LocalisationCache.php', 'LCStoreDB' => 'includes/cache/LocalisationCache.php', 'LCStoreNull' => 'includes/cache/LocalisationCache.php', diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index bdfc75a6ef..ae27fba3a4 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -200,9 +200,6 @@ class LocalisationCache { case 'db': $storeClass = 'LCStoreDB'; break; - case 'accel': - $storeClass = 'LCStoreAccel'; - break; case 'detect': $storeClass = $wgCacheDirectory ? 'LCStoreCDB' : 'LCStoreDB'; break; @@ -404,7 +401,7 @@ class LocalisationCache { $deps = $this->store->get( $code, 'deps' ); $keys = $this->store->get( $code, 'list' ); $preload = $this->store->get( $code, 'preload' ); - // Different keys may expire separately, at least in LCStoreAccel + // Different keys may expire separately for some stores if ( $deps === null || $keys === null || $preload === null ) { wfDebug( __METHOD__ . "($code): cache missing, need to make one\n" ); @@ -1134,56 +1131,6 @@ interface LCStore { function set( $key, $value ); } -/** - * LCStore implementation which uses PHP accelerator to store data. - * This will work if one of XCache, WinCache or APC cacher is configured. - * (See ObjectCache.php) - */ -class LCStoreAccel implements LCStore { - private $currentLang; - private $keys; - - public function __construct() { - $this->cache = wfGetCache( CACHE_ACCEL ); - } - - public function get( $code, $key ) { - $k = wfMemcKey( 'l10n', $code, 'k', $key ); - $r = $this->cache->get( $k ); - - return $r === false ? null : $r; - } - - public function startWrite( $code ) { - $k = wfMemcKey( 'l10n', $code, 'l' ); - $keys = $this->cache->get( $k ); - if ( $keys ) { - foreach ( $keys as $k ) { - $this->cache->delete( $k ); - } - } - $this->currentLang = $code; - $this->keys = array(); - } - - public function finishWrite() { - if ( $this->currentLang ) { - $k = wfMemcKey( 'l10n', $this->currentLang, 'l' ); - $this->cache->set( $k, array_keys( $this->keys ) ); - } - $this->currentLang = null; - $this->keys = array(); - } - - public function set( $key, $value ) { - if ( $this->currentLang ) { - $k = wfMemcKey( 'l10n', $this->currentLang, 'k', $key ); - $this->keys[$k] = true; - $this->cache->set( $k, $value ); - } - } -} - /** * LCStore implementation which uses the standard DB functions to store data. * This will work on any MediaWiki installation. -- 2.20.1