X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FObjectCache.php;h=6824d21e74dc44350c1ebd0d552794688699a83b;hb=f96c0ddd63759054b4b91d08496c7a7910275363;hp=4558ba7153b194200538e7d4b06edd08397eea07;hpb=c4855d92846d02cbad36dd23b6b59894d6c22571;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ObjectCache.php b/includes/ObjectCache.php index 4558ba7153..6824d21e74 100644 --- a/includes/ObjectCache.php +++ b/includes/ObjectCache.php @@ -1,16 +1,18 @@ true, 'compress_threshold' => 1500 ) ); - $cache =& $wgCaches[CACHE_DB]; - $cache->set_servers( $wgMemCachedServers ); - $cache->set_debug( $wgMemCachedDebug ); + if ( !array_key_exists( CACHE_MEMCACHED, $wgCaches ) ) { + $wgCaches[CACHE_MEMCACHED] = new MemCachedClientforWiki( + array('persistant' => $wgMemCachedPersistent, 'compress_threshold' => 1500 ) ); + $wgCaches[CACHE_MEMCACHED]->set_servers( $wgMemCachedServers ); + $wgCaches[CACHE_MEMCACHED]->set_debug( $wgMemCachedDebug ); } + $cache =& $wgCaches[CACHE_MEMCACHED]; } elseif ( $type == CACHE_ACCEL ) { if ( !array_key_exists( CACHE_ACCEL, $wgCaches ) ) { if ( function_exists( 'eaccelerator_get' ) ) { - require_once( 'BagOStuff.php' ); $wgCaches[CACHE_ACCEL] = new eAccelBagOStuff; - } elseif ( function_exists( 'mmcache_get' ) ) { - require_once( 'BagOStuff.php' ); - $wgCaches[CACHE_ACCEL] = new TurckBagOStuff; + } elseif ( function_exists( 'apc_fetch') ) { + $wgCaches[CACHE_ACCEL] = new APCBagOStuff; + } elseif( function_exists( 'xcache_get' ) ) { + $wgCaches[CACHE_ACCEL] = new XCacheBagOStuff(); + } elseif( function_exists( 'wincache_ucache_get' ) ) { + $wgCaches[CACHE_ACCEL] = new WinCacheBagOStuff(); } else { $wgCaches[CACHE_ACCEL] = false; } @@ -77,16 +79,20 @@ function &wfGetCache( $inputType ) { if ( $wgCaches[CACHE_ACCEL] !== false ) { $cache =& $wgCaches[CACHE_ACCEL]; } + } elseif ( $type == CACHE_DBA ) { + if ( !array_key_exists( CACHE_DBA, $wgCaches ) ) { + $wgCaches[CACHE_DBA] = new DBABagOStuff; + } + $cache =& $wgCaches[CACHE_DBA]; } if ( $type == CACHE_DB || ( $inputType == CACHE_ANYTHING && $cache === false ) ) { if ( !array_key_exists( CACHE_DB, $wgCaches ) ) { - require_once( 'BagOStuff.php' ); - $wgCaches[CACHE_DB] = new MediaWikiBagOStuff('objectcache'); + $wgCaches[CACHE_DB] = new SqlBagOStuff('objectcache'); } $cache =& $wgCaches[CACHE_DB]; } - + if ( $cache === false ) { if ( !array_key_exists( CACHE_NONE, $wgCaches ) ) { $wgCaches[CACHE_NONE] = new FakeMemCachedClient; @@ -97,19 +103,23 @@ function &wfGetCache( $inputType ) { return $cache; } +/** Get the main cache object */ function &wfGetMainCache() { global $wgMainCacheType; - return wfGetCache( $wgMainCacheType ); + $ret =& wfGetCache( $wgMainCacheType ); + return $ret; } +/** Get the cache object used by the message cache */ function &wfGetMessageCacheStorage() { global $wgMessageCacheType; - return wfGetCache( $wgMessageCacheType ); + $ret =& wfGetCache( $wgMessageCacheType ); + return $ret; } -function wfGetParserCacheStorage() { +/** Get the cache object used by the parser cache */ +function &wfGetParserCacheStorage() { global $wgParserCacheType; - return wfGetCache( $wgParserCacheType ); + $ret =& wfGetCache( $wgParserCacheType ); + return $ret; } - -?>