API: Standardize limits. Use ApiBase constants to avoid similar breakage and inconsis...
[lhc/web/wiklou.git] / includes / BagOStuff.php
index 1174997..a40d020 100644 (file)
@@ -564,6 +564,52 @@ class eAccelBagOStuff extends BagOStuff {
        }
 }
 
+/**
+ * Wrapper for XCache object caching functions; identical interface
+ * to the APC wrapper
+ */
+class XCacheBagOStuff extends BagOStuff {
+
+       /**
+        * 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;
+       }
+       
+}
+
 /**
  * @todo document
  */
@@ -663,6 +709,7 @@ class DBABagOStuff extends BagOStuff {
 
        function delete( $key, $time = 0 ) {
                wfProfileIn( __METHOD__ );
+               wfDebug( __METHOD__."($key)\n" );
                $handle = $this->getWriter();
                if ( !$handle ) {
                        return false;
@@ -698,4 +745,4 @@ class DBABagOStuff extends BagOStuff {
        }
 }
        
-?>
+