document getImageSize() return format
[lhc/web/wiklou.git] / includes / objectcache / WinCacheBagOStuff.php
1 <?php
2
3 /**
4 * Wrapper for WinCache object caching functions; identical interface
5 * to the APC wrapper
6 *
7 * @ingroup Cache
8 */
9 class WinCacheBagOStuff extends BagOStuff {
10
11 /**
12 * Get a value from the WinCache object cache
13 *
14 * @param $key String: cache key
15 * @return mixed
16 */
17 public function get( $key ) {
18 $val = wincache_ucache_get( $key );
19
20 if ( is_string( $val ) ) {
21 $val = unserialize( $val );
22 }
23
24 return $val;
25 }
26
27 /**
28 * Store a value in the WinCache object cache
29 *
30 * @param $key String: cache key
31 * @param $value Mixed: object to store
32 * @param $expire Int: expiration time
33 * @return bool
34 */
35 public function set( $key, $value, $expire = 0 ) {
36 $result = wincache_ucache_set( $key, serialize( $value ), $expire );
37
38 /* wincache_ucache_set returns an empty array on success if $value
39 was an array, bool otherwise */
40 return ( is_array( $result ) && $result === array() ) || $result;
41 }
42
43 /**
44 * Remove a value from the WinCache object cache
45 *
46 * @param $key String: cache key
47 * @param $time Int: not used in this implementation
48 * @return bool
49 */
50 public function delete( $key, $time = 0 ) {
51 wincache_ucache_delete( $key );
52
53 return true;
54 }
55
56 public function keys() {
57 $info = wincache_ucache_info();
58 $list = $info['ucache_entries'];
59 $keys = array();
60
61 if ( is_null( $list ) ) {
62 return array();
63 }
64
65 foreach ( $list as $entry ) {
66 $keys[] = $entry['key_name'];
67 }
68
69 return $keys;
70 }
71 }