diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2007-06-27 17:02:21 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2007-06-27 17:02:21 +0200 |
commit | 8add05d668d630e884f202b30811fe8b853097a6 (patch) | |
tree | a27be45b1f035210b2719f9183d286c1213b75f7 | |
parent | 1ad8de4f9a6fa3875722b5f4a42a59d80bd356ac (diff) |
Unterstützung für XCache zurückportiert
-rw-r--r-- | includes/AutoLoader.php | 1 | ||||
-rw-r--r-- | includes/BagOStuff.php | 47 | ||||
-rw-r--r-- | includes/ObjectCache.php | 2 |
3 files changed, 50 insertions, 0 deletions
diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 72a71c71..3d7bcdf3 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -244,6 +244,7 @@ function __autoload($className) { 'WikiError' => 'includes/WikiError.php', 'WikiErrorMsg' => 'includes/WikiError.php', 'WikiXmlError' => 'includes/WikiError.php', + 'XCacheBagOStuff' => 'includes/BagOStuff.php', 'Xml' => 'includes/Xml.php', 'ZhClient' => 'includes/ZhClient.php', 'memcached' => 'includes/memcached-client.php', diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php index 2a04b9dd..c0680793 100644 --- a/includes/BagOStuff.php +++ b/includes/BagOStuff.php @@ -516,6 +516,53 @@ class APCBagOStuff extends BagOStuff { /** + * Wrapper for XCache object caching functions; identical interface + * to the APC wrapper + */ +class XCacheBagOStuff extends APCBagOStuff { + + /** + * Get a value from the XCache object cache + * + * @param string $key Cache key + * @return mixed + */ + public function get( $key ) { + $val = xcache_get( $key ); + if( is_string( $val ) ) + $val = unserialize( $val ); + return $val; + } + + /** + * Store a value in the XCache object cache + * + * @param string $key Cache key + * @param mixed $value Object to store + * @param int $expire Expiration time + * @return bool + */ + public function set( $key, $value, $expire = 0 ) { + xcache_set( $key, serialize( $value ), $expire ); + return true; + } + + /** + * Remove a value from the XCache object cache + * + * @param string $key Cache key + * @param int $time Not used in this implementation + * @return bool + */ + public function delete( $key, $time = 0 ) { + xcache_unset( $key ); + return true; + } + +} + + +/** * This is a wrapper for eAccelerator's shared memory functions. * * This is basically identical to the Turck MMCache version, diff --git a/includes/ObjectCache.php b/includes/ObjectCache.php index a493a75c..3b43dd53 100644 --- a/includes/ObjectCache.php +++ b/includes/ObjectCache.php @@ -70,6 +70,8 @@ function &wfGetCache( $inputType ) { $wgCaches[CACHE_ACCEL] = new eAccelBagOStuff; } elseif ( function_exists( 'apc_fetch') ) { $wgCaches[CACHE_ACCEL] = new APCBagOStuff; + } elseif( function_exists( 'xcache_get' ) ) { + $wgCaches[CACHE_ACCEL] = new XCacheBagOStuff; } elseif ( function_exists( 'mmcache_get' ) ) { $wgCaches[CACHE_ACCEL] = new TurckBagOStuff; } else { |