From 8add05d668d630e884f202b30811fe8b853097a6 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 27 Jun 2007 17:02:21 +0200 Subject: Unterstützung für XCache zurückportiert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/BagOStuff.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'includes/BagOStuff.php') diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php index 2a04b9dd..c0680793 100644 --- a/includes/BagOStuff.php +++ b/includes/BagOStuff.php @@ -515,6 +515,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. * -- cgit v1.2.3-54-g00ecf