MediaWiki  REL1_24
MemcachedPeclBagOStuff Class Reference

A wrapper class for the PECL memcached client. More...

Inheritance diagram for MemcachedPeclBagOStuff:
Collaboration diagram for MemcachedPeclBagOStuff:

List of all members.

Public Member Functions

 __construct ($params)
 Constructor.
 add ($key, $value, $exptime=0)
 cas ($casToken, $key, $value, $exptime=0)
 decr ($key, $value=1)
 delete ($key, $time=0)
 get ($key, &$casToken=null)
 getMulti (array $keys)
 incr ($key, $value=1)
 set ($key, $value, $exptime=0)
 setMulti (array $data, $exptime=0)

Protected Member Functions

 checkResult ($key, $result)
 Check the return value from a client method call and take any necessary action.

Detailed Description

A wrapper class for the PECL memcached client.

Definition at line 29 of file MemcachedPeclBagOStuff.php.


Constructor & Destructor Documentation

Constructor.

Available parameters are:

  • servers: The list of IP:port combinations holding the memcached servers.
  • 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
  • retry_timeout: Time in seconds to wait before retrying a failed connect attempt
  • server_failure_limit: Limit for server connect failures before it is removed
  • serializer: May be either "php" or "igbinary". Igbinary produces more compact values, but serialization is much slower unless the php.ini option igbinary.compact_strings is off.
    Parameters:
    array$params

Definition at line 47 of file MemcachedPeclBagOStuff.php.

References $params, MemcachedBagOStuff\applyDefaultParams(), array(), as, IP\splitHostAndPort(), and wfDebug().


Member Function Documentation

MemcachedPeclBagOStuff::add ( key,
value,
exptime = 0 
)
Parameters:
string$key
int$value
int$exptime
Returns:
mixed

Reimplemented from MemcachedBagOStuff.

Definition at line 175 of file MemcachedPeclBagOStuff.php.

References $key, $value, add, checkResult(), and MemcachedBagOStuff\debugLog().

MemcachedPeclBagOStuff::cas ( casToken,
key,
value,
exptime = 0 
)
Parameters:
float$casToken
string$key
mixed$value
int$exptime
Returns:
bool

Reimplemented from MemcachedBagOStuff.

Definition at line 148 of file MemcachedPeclBagOStuff.php.

References $key, $value, checkResult(), and MemcachedBagOStuff\debugLog().

MemcachedPeclBagOStuff::checkResult ( key,
result 
) [protected]

Check the return value from a client method call and take any necessary action.

Returns the value that the wrapper function should return. At present, the return value is always the same as the return value from the client, but some day we might find a case where it should be different.

Parameters:
string$keyThe key used by the caller, or false if there wasn't one.
mixed$resultThe return value
Returns:
mixed

Definition at line 213 of file MemcachedPeclBagOStuff.php.

References $key, $result, MemcachedBagOStuff\debugLog(), BagOStuff\ERR_UNEXPECTED, BagOStuff\setLastError(), and wfDebugLog().

Referenced by add(), cas(), decr(), delete(), get(), getMulti(), incr(), set(), and setMulti().

MemcachedPeclBagOStuff::decr ( key,
value = 1 
)
Parameters:
string$key
int$value
Returns:
mixed

Reimplemented from BagOStuff.

Definition at line 196 of file MemcachedPeclBagOStuff.php.

References $key, $result, $value, checkResult(), and MemcachedBagOStuff\debugLog().

MemcachedPeclBagOStuff::delete ( key,
time = 0 
)
Parameters:
string$key
int$time
Returns:
bool

Reimplemented from MemcachedBagOStuff.

Definition at line 158 of file MemcachedPeclBagOStuff.php.

References $key, $result, $time, checkResult(), and MemcachedBagOStuff\debugLog().

MemcachedPeclBagOStuff::get ( key,
&$  casToken = null 
)
Parameters:
string$key
float$casToken[optional]
Returns:
mixed

Reimplemented from MemcachedBagOStuff.

Definition at line 121 of file MemcachedPeclBagOStuff.php.

References $key, $result, checkResult(), MemcachedBagOStuff\debugLog(), MemcachedBagOStuff\encodeKey(), wfProfileIn(), and wfProfileOut().

Parameters:
array$keys
Returns:
array

Reimplemented from BagOStuff.

Definition at line 244 of file MemcachedPeclBagOStuff.php.

References $result, array(), checkResult(), MemcachedBagOStuff\debugLog(), wfProfileIn(), and wfProfileOut().

MemcachedPeclBagOStuff::incr ( key,
value = 1 
)
Parameters:
string$key
int$value
Returns:
mixed

Reimplemented from BagOStuff.

Definition at line 185 of file MemcachedPeclBagOStuff.php.

References $key, $result, $value, checkResult(), and MemcachedBagOStuff\debugLog().

MemcachedPeclBagOStuff::set ( key,
value,
exptime = 0 
)
Parameters:
string$key
mixed$value
int$exptime
Returns:
bool

Reimplemented from MemcachedBagOStuff.

Definition at line 136 of file MemcachedPeclBagOStuff.php.

References $key, $value, checkResult(), MemcachedBagOStuff\debugLog(), and set.

MemcachedPeclBagOStuff::setMulti ( array data,
exptime = 0 
)
Parameters:
array$data
int$exptime
Returns:
bool

Reimplemented from BagOStuff.

Definition at line 259 of file MemcachedPeclBagOStuff.php.

References $key, $result, $value, as, checkResult(), MemcachedBagOStuff\debugLog(), MemcachedBagOStuff\encodeKey(), MemcachedBagOStuff\fixExpiry(), wfProfileIn(), and wfProfileOut().


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