MediaWiki  1.23.2
XCacheBagOStuff.php
Go to the documentation of this file.
1 <?php
30 class XCacheBagOStuff extends BagOStuff {
38  public function get( $key, &$casToken = null ) {
39  $val = xcache_get( $key );
40 
41  if ( is_string( $val ) ) {
42  if ( $this->isInteger( $val ) ) {
43  $val = intval( $val );
44  } else {
45  $val = unserialize( $val );
46  }
47  } elseif ( is_null( $val ) ) {
48  return false;
49  }
50 
51  return $val;
52  }
53 
62  public function set( $key, $value, $expire = 0 ) {
63  if ( !$this->isInteger( $value ) ) {
64  $value = serialize( $value );
65  }
66 
67  xcache_set( $key, $value, $expire );
68  return true;
69  }
70 
78  public function cas( $casToken, $key, $value, $exptime = 0 ) {
79  // Can't find any documentation on xcache cas
80  throw new MWException( "CAS is not implemented in " . __CLASS__ );
81  }
82 
90  public function delete( $key, $time = 0 ) {
91  xcache_unset( $key );
92  return true;
93  }
94 
106  public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) {
107  return $this->mergeViaLock( $key, $callback, $exptime, $attempts );
108  }
109 
110  public function incr( $key, $value = 1 ) {
111  return xcache_inc( $key, $value );
112  }
113 
114  public function decr( $key, $value = 1 ) {
115  return xcache_dec( $key, $value );
116  }
117 }
BagOStuff\isInteger
isInteger( $value)
Check if a value is an integer.
Definition: BagOStuff.php:384
$time
see documentation in includes Linker php for Linker::makeImageLink & $time
Definition: hooks.txt:1358
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
BagOStuff
interface is intended to be more or less compatible with the PHP memcached client.
Definition: BagOStuff.php:43
XCacheBagOStuff\incr
incr( $key, $value=1)
Increase stored value of $key by $value while preserving its TTL.
Definition: XCacheBagOStuff.php:110
XCacheBagOStuff\merge
merge( $key, closure $callback, $exptime=0, $attempts=10)
Merge an item.
Definition: XCacheBagOStuff.php:106
MWException
MediaWiki exception.
Definition: MWException.php:26
XCacheBagOStuff\decr
decr( $key, $value=1)
Decrease stored value of $key by $value while preserving its TTL.
Definition: XCacheBagOStuff.php:114
XCacheBagOStuff\cas
cas( $casToken, $key, $value, $exptime=0)
Definition: XCacheBagOStuff.php:78
$value
$value
Definition: styleTest.css.php:45
BagOStuff\mergeViaLock
mergeViaLock( $key, closure $callback, $exptime=0, $attempts=10)
Definition: BagOStuff.php:152
XCacheBagOStuff
Wrapper for XCache object caching functions; identical interface to the APC wrapper.
Definition: XCacheBagOStuff.php:30