MediaWiki  1.23.6
APCBagOStuff.php
Go to the documentation of this file.
1 <?php
29 class APCBagOStuff extends BagOStuff {
35  public function get( $key, &$casToken = null ) {
36  $val = apc_fetch( $key );
37 
38  $casToken = $val;
39 
40  if ( is_string( $val ) ) {
41  if ( $this->isInteger( $val ) ) {
42  $val = intval( $val );
43  } else {
44  $val = unserialize( $val );
45  }
46  }
47 
48  return $val;
49  }
50 
57  public function set( $key, $value, $exptime = 0 ) {
58  if ( !$this->isInteger( $value ) ) {
59  $value = serialize( $value );
60  }
61 
62  apc_store( $key, $value, $exptime );
63 
64  return true;
65  }
66 
74  public function cas( $casToken, $key, $value, $exptime = 0 ) {
75  // APC's CAS functions only work on integers
76  throw new MWException( "CAS is not implemented in " . __CLASS__ );
77  }
78 
84  public function delete( $key, $time = 0 ) {
85  apc_delete( $key );
86 
87  return true;
88  }
89 
97  public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) {
98  return $this->mergeViaLock( $key, $callback, $exptime, $attempts );
99  }
100 
101  public function incr( $key, $value = 1 ) {
102  return apc_inc( $key, $value );
103  }
104 
105  public function decr( $key, $value = 1 ) {
106  return apc_dec( $key, $value );
107  }
108 }
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
APCBagOStuff\merge
merge( $key, closure $callback, $exptime=0, $attempts=10)
Definition: APCBagOStuff.php:97
BagOStuff
interface is intended to be more or less compatible with the PHP memcached client.
Definition: BagOStuff.php:43
MWException
MediaWiki exception.
Definition: MWException.php:26
APCBagOStuff\decr
decr( $key, $value=1)
Decrease stored value of $key by $value while preserving its TTL.
Definition: APCBagOStuff.php:105
$value
$value
Definition: styleTest.css.php:45
APCBagOStuff\cas
cas( $casToken, $key, $value, $exptime=0)
Definition: APCBagOStuff.php:74
BagOStuff\mergeViaLock
mergeViaLock( $key, closure $callback, $exptime=0, $attempts=10)
Definition: BagOStuff.php:152
APCBagOStuff\incr
incr( $key, $value=1)
Increase stored value of $key by $value while preserving its TTL.
Definition: APCBagOStuff.php:101
APCBagOStuff
This is a wrapper for APC's shared memory functions.
Definition: APCBagOStuff.php:29