MediaWiki  1.23.2
MemcachedPhpBagOStuff Class Reference

A wrapper class for the pure-PHP memcached client, exposing a BagOStuff interface. More...

Inheritance diagram for MemcachedPhpBagOStuff:
Collaboration diagram for MemcachedPhpBagOStuff:

Public Member Functions

 __construct ( $params)
 Constructor. More...
 
 decr ( $key, $value=1)
 
 getMulti (array $keys)
 
 incr ( $key, $value=1)
 
 lock ( $key, $timeout=0)
 
 setDebug ( $debug)
 
 unlock ( $key)
 
- Public Member Functions inherited from MemcachedBagOStuff
 add ( $key, $value, $exptime=0)
 
 cas ( $casToken, $key, $value, $exptime=0)
 
 decodeKey ( $key)
 Decode a key encoded with encodeKey(). More...
 
 delete ( $key, $time=0)
 
 encodeKey ( $key)
 Encode a key for use on the wire inside the memcached protocol. More...
 
 fixExpiry ( $expiry)
 TTLs higher than 30 days will be detected as absolute TTLs (UNIX timestamps), and will result in the cache entry being discarded immediately because the expiry is in the past. More...
 
 get ( $key, &$casToken=null)
 
 getClient ()
 Get the underlying client object. More...
 
 set ( $key, $value, $exptime=0)
 
- Public Member Functions inherited from BagOStuff
 clearLastError ()
 Clear the "last error" registry. More...
 
 debug ( $text)
 
 deleteObjectsExpiringBefore ( $date, $progressCallback=false)
 Delete all objects expiring before a certain date. More...
 
 getLastError ()
 Get the "last error" registered; clearLastError() should be called manually. More...
 
 merge ( $key, closure $callback, $exptime=0, $attempts=10)
 Merge changes into the existing cache value (possibly creating a new one). More...
 
 replace ( $key, $value, $exptime=0)
 

Additional Inherited Members

- Public Attributes inherited from BagOStuff
const ERR_NO_RESPONSE = 1
 
const ERR_NONE = 0
 Possible values for getLastError() More...
 
const ERR_UNEXPECTED = 3
 
const ERR_UNREACHABLE = 2
 
- Protected Member Functions inherited from MemcachedBagOStuff
 applyDefaultParams ( $params)
 Fill in the defaults for any parameters missing from $params, using the backwards-compatible global variables. More...
 
 debugLog ( $text)
 Send a debug message to the log. More...
 
 encodeKeyCallback ( $m)
 
- Protected Member Functions inherited from BagOStuff
 convertExpiry ( $exptime)
 Convert an optionally relative time to an absolute time. More...
 
 convertToRelative ( $exptime)
 Convert an optionally absolute expiry time to a relative time. More...
 
 isInteger ( $value)
 Check if a value is an integer. More...
 
 mergeViaCas ( $key, closure $callback, $exptime=0, $attempts=10)
 
 mergeViaLock ( $key, closure $callback, $exptime=0, $attempts=10)
 
 setLastError ( $err)
 Set the "last error" registry. More...
 
- Protected Attributes inherited from MemcachedBagOStuff
 $client
 
- Protected Attributes inherited from BagOStuff
 $lastError = self::ERR_NONE
 

Detailed Description

A wrapper class for the pure-PHP memcached client, exposing a BagOStuff interface.

Definition at line 29 of file MemcachedPhpBagOStuff.php.

Constructor & Destructor Documentation

◆ __construct()

MemcachedPhpBagOStuff::__construct (   $params)

Constructor.

Available parameters are:

  • servers: The list of IP:port combinations holding the memcached servers.
  • debug: Whether to set the debug flag in the underlying client.
  • persistent: Whether to use a persistent connection
  • compress_threshold: The minimum size an object must be before it is compressed
  • timeout: The read timeout in microseconds
  • connect_timeout: The connect timeout in seconds
Parameters
$paramsarray

Definition at line 44 of file MemcachedPhpBagOStuff.php.

References $params, and MemcachedBagOStuff\applyDefaultParams().

Member Function Documentation

◆ decr()

MemcachedPhpBagOStuff::decr (   $key,
  $value = 1 
)
Parameters
$keystring
$valueint
Returns
Mixed

Reimplemented from BagOStuff.

Definition at line 99 of file MemcachedPhpBagOStuff.php.

References $value, and MemcachedBagOStuff\encodeKey().

◆ getMulti()

MemcachedPhpBagOStuff::getMulti ( array  $keys)
Parameters
$keysArray
Returns
Array

Reimplemented from BagOStuff.

Definition at line 63 of file MemcachedPhpBagOStuff.php.

References $keys, and array().

◆ incr()

MemcachedPhpBagOStuff::incr (   $key,
  $value = 1 
)
Parameters
$keystring
$valueint
Returns
Mixed

Reimplemented from BagOStuff.

Definition at line 90 of file MemcachedPhpBagOStuff.php.

References $value, and MemcachedBagOStuff\encodeKey().

◆ lock()

MemcachedPhpBagOStuff::lock (   $key,
  $timeout = 0 
)
Parameters
$key
$timeoutint
Returns
bool

Reimplemented from BagOStuff.

Definition at line 73 of file MemcachedPhpBagOStuff.php.

References MemcachedBagOStuff\encodeKey().

◆ setDebug()

MemcachedPhpBagOStuff::setDebug (   $debug)
Parameters
$debugbool

Reimplemented from BagOStuff.

Definition at line 55 of file MemcachedPhpBagOStuff.php.

References $debug.

◆ unlock()

MemcachedPhpBagOStuff::unlock (   $key)
Parameters
$keystring
Returns
Mixed

Reimplemented from BagOStuff.

Definition at line 81 of file MemcachedPhpBagOStuff.php.

References MemcachedBagOStuff\encodeKey().


The documentation for this class was generated from the following file: