diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2007-06-29 00:35:10 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2007-06-29 00:35:10 +0200 |
commit | d266776bfd3badcc5ba1f7cc45fcabcfc7c2e3b9 (patch) | |
tree | 7006992ad616ed28595ae6a5c438514737152b06 /includes | |
parent | bf0389a19ba0be16072cefc6c0117cfb84916423 (diff) |
XCache-Interface optimiert
Diffstat (limited to 'includes')
-rw-r--r-- | includes/BagOStuff.php | 59 |
1 files changed, 23 insertions, 36 deletions
diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php index c0680793..3deafb13 100644 --- a/includes/BagOStuff.php +++ b/includes/BagOStuff.php @@ -516,49 +516,36 @@ class APCBagOStuff extends BagOStuff { /** - * Wrapper for XCache object caching functions; identical interface - * to the APC wrapper + * Wrapper for XCache object caching functions */ -class XCacheBagOStuff extends APCBagOStuff { - - /** - * Get a value from the XCache object cache - * - * @param string $key Cache key - * @return mixed - */ +class XCacheBagOStuff extends BagOStuff { public function get( $key ) { - $val = xcache_get( $key ); - if( is_string( $val ) ) - $val = unserialize( $val ); - return $val; + return xcache_get( $key ); } - - /** - * 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; + return xcache_set( $key, $value, $expire ); } - - /** - * 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; + return xcache_unset( $key ); + } + + function incr($key, $value=1) { + return (xcache_isset($key) && xcache_inc($key. $value)); + } + + function decr($key, $value=1) { + return (xcache_isset($key) && xcache_dec($key. $value)); + } + + function add($key, $value, $exptime=0) { + return (!xcache_isset($key) && xcache_set( $key, $value, $expire )); + } + + function replace($key, $value, $exptime=0) { + return (xcache_isset($key) && xcache_set( $key, $value, $expire )); } - } |