MediaWiki  REL1_31
Go to the documentation of this file.
1 <?php
41  function __construct( $params ) {
42  parent::__construct( $params );
45  $this->client = new MemcachedClient( $params );
46  $this->client->set_servers( $params['servers'] );
47  $this->client->set_debug( $params['debug'] );
48  }
50  public function setDebug( $debug ) {
51  $this->client->set_debug( $debug );
52  }
54  public function getMulti( array $keys, $flags = 0 ) {
55  foreach ( $keys as $key ) {
56  $this->validateKeyEncoding( $key );
57  }
59  return $this->client->get_multi( $keys );
60  }
62  public function incr( $key, $value = 1 ) {
63  $this->validateKeyEncoding( $key );
65  return $this->client->incr( $key, $value ) ?? false;
66  }
68  public function decr( $key, $value = 1 ) {
69  $this->validateKeyEncoding( $key );
71  return $this->client->decr( $key, $value ) ?? false;
72  }
73 }
Base class for memcached clients.
Definition: MemcachedBagOStuff.php:29
the array() calling protocol came about after MediaWiki 1.4rc1.
applyDefaultParams( $params)
Fill in some defaults for missing keys in $params.
Definition: MemcachedBagOStuff.php:45
__construct( $params)
Available parameters are:
Definition: MemcachedPhpBagOStuff.php:41
A wrapper class for the pure-PHP memcached client, exposing a BagOStuff interface.
Definition: MemcachedPhpBagOStuff.php:29
Definition: styleTest.css.php:40
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:37
memcached client class implemented using (p)fsockopen()
Definition: MemcachedClient.php:79
Definition: mcc.php:31
setDebug( $debug)
Definition: MemcachedPhpBagOStuff.php:50
getMulti(array $keys, $flags=0)
Get an associative array containing the item for each of the keys that have items.
Definition: MemcachedPhpBagOStuff.php:54
Definition: styleTest.css.php:45
incr( $key, $value=1)
Increase stored value of $key by $value while preserving its TTL.
Definition: MemcachedPhpBagOStuff.php:62
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:22
Definition: testCompression.php:67
validateKeyEncoding( $key)
Ensure that a key is safe to use (contains no control characters and no characters above the ASCII ra...
Definition: MemcachedBagOStuff.php:154
decr( $key, $value=1)
Decrease stored value of $key by $value while preserving its TTL.
Definition: MemcachedPhpBagOStuff.php:68