MediaWiki REL1_31
MemcachedPhpBagOStuff.php
Go to the documentation of this file.
1<?php
41 function __construct( $params ) {
42 parent::__construct( $params );
44
45 $this->client = new MemcachedClient( $params );
46 $this->client->set_servers( $params['servers'] );
47 $this->client->set_debug( $params['debug'] );
48 }
49
50 public function setDebug( $debug ) {
51 $this->client->set_debug( $debug );
52 }
53
54 public function getMulti( array $keys, $flags = 0 ) {
55 foreach ( $keys as $key ) {
56 $this->validateKeyEncoding( $key );
57 }
58
59 return $this->client->get_multi( $keys );
60 }
61
62 public function incr( $key, $value = 1 ) {
63 $this->validateKeyEncoding( $key );
64
65 return $this->client->incr( $key, $value ) ?? false;
66 }
67
68 public function decr( $key, $value = 1 ) {
69 $this->validateKeyEncoding( $key );
70
71 return $this->client->decr( $key, $value ) ?? false;
72 }
73}
Base class for memcached clients.
validateKeyEncoding( $key)
Ensure that a key is safe to use (contains no control characters and no characters above the ASCII ra...
applyDefaultParams( $params)
Fill in some defaults for missing keys in $params.
memcached client class implemented using (p)fsockopen()
A wrapper class for the pure-PHP memcached client, exposing a BagOStuff interface.
__construct( $params)
Available parameters are:
decr( $key, $value=1)
Decrease stored value of $key by $value while preserving its TTL.
incr( $key, $value=1)
Increase stored value of $key by $value while preserving its TTL.
getMulti(array $keys, $flags=0)
Get an associative array containing the item for each of the keys that have items.
$debug
Definition mcc.php:31
$params