MediaWiki  REL1_22
WinCacheBagOStuff.php
Go to the documentation of this file.
00001 <?php
00030 class WinCacheBagOStuff extends BagOStuff {
00031 
00039     public function get( $key, &$casToken = null ) {
00040         $val = wincache_ucache_get( $key );
00041 
00042         $casToken = $val;
00043 
00044         if ( is_string( $val ) ) {
00045             $val = unserialize( $val );
00046         }
00047 
00048         return $val;
00049     }
00050 
00059     public function set( $key, $value, $expire = 0 ) {
00060         $result = wincache_ucache_set( $key, serialize( $value ), $expire );
00061 
00062         /* wincache_ucache_set returns an empty array on success if $value
00063            was an array, bool otherwise */
00064         return ( is_array( $result ) && $result === array() ) || $result;
00065     }
00066 
00076     public function cas( $casToken, $key, $value, $exptime = 0 ) {
00077         return wincache_ucache_cas( $key, $casToken, serialize( $value ) );
00078     }
00079 
00087     public function delete( $key, $time = 0 ) {
00088         wincache_ucache_delete( $key );
00089 
00090         return true;
00091     }
00092 }