MediaWiki  1.32.0
APCUBagOStuff.php
Go to the documentation of this file.
1 <?php
29 class APCUBagOStuff extends APCBagOStuff {
38  public function __construct( array $params = [] ) {
39  parent::__construct( $params );
40  }
41 
42  protected function doGet( $key, $flags = 0 ) {
43  return $this->getUnserialize(
44  apcu_fetch( $key . self::KEY_SUFFIX )
45  );
46  }
47 
48  public function set( $key, $value, $exptime = 0, $flags = 0 ) {
49  apcu_store(
50  $key . self::KEY_SUFFIX,
51  $this->setSerialize( $value ),
52  $exptime
53  );
54 
55  return true;
56  }
57 
58  public function delete( $key ) {
59  apcu_delete( $key . self::KEY_SUFFIX );
60 
61  return true;
62  }
63 
64  public function incr( $key, $value = 1 ) {
70  if ( apcu_exists( $key . self::KEY_SUFFIX ) ) {
71  return apcu_inc( $key . self::KEY_SUFFIX, $value );
72  } else {
73  return false;
74  }
75  }
76 
77  public function decr( $key, $value = 1 ) {
83  if ( apcu_exists( $key . self::KEY_SUFFIX ) ) {
84  return apcu_dec( $key . self::KEY_SUFFIX, $value );
85  } else {
86  return false;
87  }
88  }
89 }
APCUBagOStuff\doGet
doGet( $key, $flags=0)
Definition: APCUBagOStuff.php:42
$params
$params
Definition: styleTest.css.php:44
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
APCUBagOStuff\decr
decr( $key, $value=1)
Decrease stored value of $key by $value while preserving its TTL.
Definition: APCUBagOStuff.php:77
APCBagOStuff\getUnserialize
getUnserialize( $value)
Definition: APCBagOStuff.php:81
APCUBagOStuff\__construct
__construct(array $params=[])
Available parameters are:
Definition: APCUBagOStuff.php:38
array
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
APCUBagOStuff\incr
incr( $key, $value=1)
Increase stored value of $key by $value while preserving its TTL.
Definition: APCUBagOStuff.php:64
$value
$value
Definition: styleTest.css.php:49
APCUBagOStuff
This is a wrapper for APCU's shared memory functions.
Definition: APCUBagOStuff.php:29
APCBagOStuff\setSerialize
setSerialize( $value)
Definition: APCBagOStuff.php:100
APCBagOStuff
This is a wrapper for APC's shared memory functions.
Definition: APCBagOStuff.php:29