MediaWiki  REL1_20
XCacheBagOStuff.php
Go to the documentation of this file.
00001 <?php
00030 class XCacheBagOStuff extends BagOStuff {
00037         public function get( $key ) {
00038                 $val = xcache_get( $key );
00039 
00040                 if ( is_string( $val ) ) {
00041                         if ( $this->isInteger( $val ) ) {
00042                                 $val = intval( $val );
00043                         } else {
00044                                 $val = unserialize( $val );
00045                         }
00046                 } elseif ( is_null( $val ) ) {
00047                         return false;
00048                 }
00049 
00050                 return $val;
00051         }
00052 
00061         public function set( $key, $value, $expire = 0 ) {
00062                 if ( !$this->isInteger( $value ) ) {
00063                         $value = serialize( $value );
00064                 }
00065 
00066                 xcache_set( $key, $value, $expire );
00067                 return true;
00068         }
00069 
00077         public function delete( $key, $time = 0 ) {
00078                 xcache_unset( $key );
00079                 return true;
00080         }
00081 
00082         public function incr( $key, $value = 1 ) {
00083                 return xcache_inc( $key, $value );
00084         }
00085 
00086         public function decr( $key, $value = 1 ) {
00087                 return xcache_dec( $key, $value );
00088         }
00089 }