MediaWiki  REL1_19
WinCacheBagOStuff.php
Go to the documentation of this file.
00001 <?php
00002 
00009 class WinCacheBagOStuff extends BagOStuff {
00010 
00017         public function get( $key ) {
00018                 $val = wincache_ucache_get( $key );
00019 
00020                 if ( is_string( $val ) ) {
00021                         $val = unserialize( $val );
00022                 }
00023 
00024                 return $val;
00025         }
00026 
00035         public function set( $key, $value, $expire = 0 ) {
00036                 $result = wincache_ucache_set( $key, serialize( $value ), $expire );
00037 
00038                 /* wincache_ucache_set returns an empty array on success if $value
00039                    was an array, bool otherwise */
00040                 return ( is_array( $result ) && $result === array() ) || $result;
00041         }
00042 
00050         public function delete( $key, $time = 0 ) {
00051                 wincache_ucache_delete( $key );
00052 
00053                 return true;
00054         }
00055 
00056         public function keys() {
00057                 $info = wincache_ucache_info();
00058                 $list = $info['ucache_entries'];
00059                 $keys = array();
00060 
00061                 if ( is_null( $list ) ) {
00062                         return array();
00063                 }
00064 
00065                 foreach ( $list as $entry ) {
00066                         $keys[] = $entry['key_name'];
00067                 }
00068 
00069                 return $keys;
00070         }
00071 }