Simplify $assoc check
[mediawiki.git] / includes / objectcache / XCacheBagOStuff.php
blob0ddf12456e58035c63b076257825c3b10c5ef214
1 <?php
3 /**
4 * Wrapper for XCache object caching functions; identical interface
5 * to the APC wrapper
7 * @ingroup Cache
8 */
9 class XCacheBagOStuff extends BagOStuff {
10 /**
11 * Get a value from the XCache object cache
13 * @param $key String: cache key
14 * @return mixed
16 public function get( $key ) {
17 $val = xcache_get( $key );
19 if ( is_string( $val ) ) {
20 $val = unserialize( $val );
23 return $val;
26 /**
27 * Store a value in the XCache object cache
29 * @param $key String: cache key
30 * @param $value Mixed: object to store
31 * @param $expire Int: expiration time
32 * @return bool
34 public function set( $key, $value, $expire = 0 ) {
35 xcache_set( $key, serialize( $value ), $expire );
36 return true;
39 /**
40 * Remove a value from the XCache object cache
42 * @param $key String: cache key
43 * @param $time Int: not used in this implementation
44 * @return bool
46 public function delete( $key, $time = 0 ) {
47 xcache_unset( $key );
48 return true;