Start of ObjectCache reorganisation. Moved the object cache files to includes/objectc...
[lhc/web/wiklou.git] / includes / objectcache / XCacheBagOStuff.php
1 <?php
2
3 /**
4 * Wrapper for XCache object caching functions; identical interface
5 * to the APC wrapper
6 *
7 * @ingroup Cache
8 */
9 class XCacheBagOStuff extends BagOStuff {
10 /**
11 * Get a value from the XCache object cache
12 *
13 * @param $key String: cache key
14 * @return mixed
15 */
16 public function get( $key ) {
17 $val = xcache_get( $key );
18
19 if ( is_string( $val ) ) {
20 $val = unserialize( $val );
21 }
22
23 return $val;
24 }
25
26 /**
27 * Store a value in the XCache object cache
28 *
29 * @param $key String: cache key
30 * @param $value Mixed: object to store
31 * @param $expire Int: expiration time
32 * @return bool
33 */
34 public function set( $key, $value, $expire = 0 ) {
35 xcache_set( $key, serialize( $value ), $expire );
36
37 return true;
38 }
39
40 /**
41 * Remove a value from the XCache object cache
42 *
43 * @param $key String: cache key
44 * @param $time Int: not used in this implementation
45 * @return bool
46 */
47 public function delete( $key, $time = 0 ) {
48 xcache_unset( $key );
49
50 return true;
51 }
52 }
53