MediaWiki  1.29.1
Go to the documentation of this file.
1 <?php
30 class XCacheBagOStuff extends BagOStuff {
31  protected function doGet( $key, $flags = 0 ) {
32  $val = xcache_get( $key );
34  if ( is_string( $val ) ) {
35  if ( $this->isInteger( $val ) ) {
36  $val = intval( $val );
37  } else {
38  $val = unserialize( $val );
39  }
40  } elseif ( is_null( $val ) ) {
41  return false;
42  }
44  return $val;
45  }
47  public function set( $key, $value, $expire = 0, $flags = 0 ) {
48  if ( !$this->isInteger( $value ) ) {
49  $value = serialize( $value );
50  }
52  xcache_set( $key, $value, $expire );
53  return true;
54  }
56  public function delete( $key ) {
57  xcache_unset( $key );
58  return true;
59  }
61  public function incr( $key, $value = 1 ) {
62  return xcache_inc( $key, $value );
63  }
65  public function decr( $key, $value = 1 ) {
66  return xcache_dec( $key, $value );
67  }
68 }
isInteger( $value)
Check if a value is an integer.
Definition: BagOStuff.php:725
doGet( $key, $flags=0)
Definition: XCacheBagOStuff.php:31
unserialize( $serialized)
Definition: ApiMessage.php:185
Definition: ApiMessage.php:177
interface is intended to be more or less compatible with the PHP memcached client.
Definition: BagOStuff.php:47
incr( $key, $value=1)
Increase stored value of $key by $value while preserving its TTL.
Definition: XCacheBagOStuff.php:61
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
decr( $key, $value=1)
Decrease stored value of $key by $value while preserving its TTL.
Definition: XCacheBagOStuff.php:65
Definition: styleTest.css.php:45
Wrapper for XCache object caching functions; identical interface to the APC wrapper.
Definition: XCacheBagOStuff.php:30
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2749