MediaWiki  REL1_22
MemcachedBagOStuff Class Reference

Base class for memcached clients. More...

Inheritance diagram for MemcachedBagOStuff:
Collaboration diagram for MemcachedBagOStuff:

List of all members.

Public Member Functions

 add ($key, $value, $exptime=0)
 cas ($casToken, $key, $value, $exptime=0)
 decodeKey ($key)
 Decode a key encoded with encodeKey().
 delete ($key, $time=0)
 encodeKey ($key)
 Encode a key for use on the wire inside the memcached protocol.
 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.
 get ($key, &$casToken=null)
 getClient ()
 Get the underlying client object.
 replace ($key, $value, $exptime=0)
 set ($key, $value, $exptime=0)

Protected Member Functions

 applyDefaultParams ($params)
 Fill in the defaults for any parameters missing from $params, using the backwards-compatible global variables.
 debugLog ($text)
 Send a debug message to the log.
 encodeKeyCallback ($m)

Protected Attributes

 $client

Detailed Description

Base class for memcached clients.

Definition at line 29 of file MemcachedBagOStuff.php.


Member Function Documentation

MemcachedBagOStuff::add ( key,
value,
exptime = 0 
)
Parameters:
$keystring
$valueint
int$exptime(default 0)
Returns:
Mixed

Reimplemented from BagOStuff.

Reimplemented in MemcachedPeclBagOStuff.

Definition at line 105 of file MemcachedBagOStuff.php.

References $key, $value, encodeKey(), and fixExpiry().

MemcachedBagOStuff::applyDefaultParams ( params) [protected]

Fill in the defaults for any parameters missing from $params, using the backwards-compatible global variables.

Definition at line 36 of file MemcachedBagOStuff.php.

References $params.

Referenced by MemcachedPhpBagOStuff\__construct(), and MemcachedPeclBagOStuff\__construct().

MemcachedBagOStuff::cas ( casToken,
key,
value,
exptime = 0 
)
Parameters:
$keystring
$casTokenmixed
$value
$exptimeint
Returns:
bool

Reimplemented from BagOStuff.

Reimplemented in MemcachedPeclBagOStuff.

Definition at line 85 of file MemcachedBagOStuff.php.

References $key, $value, encodeKey(), and fixExpiry().

Decode a key encoded with encodeKey().

This is provided as a convenience function for debugging.

Parameters:
$keystring
Returns:
string

Definition at line 174 of file MemcachedBagOStuff.php.

References $key.

MemcachedBagOStuff::delete ( key,
time = 0 
)
Parameters:
$keystring
$timeint
Returns:
bool

Reimplemented from BagOStuff.

Reimplemented in MemcachedPeclBagOStuff.

Definition at line 95 of file MemcachedBagOStuff.php.

References $key, $time, and encodeKey().

Encode a key for use on the wire inside the memcached protocol.

We encode spaces and line breaks to avoid protocol errors. We encode the other control characters for compatibility with libmemcached verify_key. We leave other punctuation alone, to maximise backwards compatibility.

Parameters:
$keystring
Returns:
string

Definition at line 139 of file MemcachedBagOStuff.php.

References $key, and array().

Referenced by add(), cas(), MemcachedPhpBagOStuff\decr(), delete(), get(), MemcachedPeclBagOStuff\get(), MemcachedPhpBagOStuff\incr(), MemcachedPhpBagOStuff\lock(), replace(), set(), and MemcachedPhpBagOStuff\unlock().

Parameters:
$marray
Returns:
string

Definition at line 148 of file MemcachedBagOStuff.php.

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.

Clamp expiries >30d at 30d, unless they're >=1e9 in which case they are likely to really be absolute (1e9 = 2011-09-09)

Definition at line 159 of file MemcachedBagOStuff.php.

Referenced by add(), cas(), replace(), and set().

MemcachedBagOStuff::get ( key,
&$  casToken = null 
)
Parameters:
$keystring
$casToken[optional]mixed
Returns:
Mixed

Reimplemented from BagOStuff.

Reimplemented in MemcachedPeclBagOStuff.

Definition at line 63 of file MemcachedBagOStuff.php.

References $key, and encodeKey().

Get the underlying client object.

This is provided for debugging purposes.

Definition at line 125 of file MemcachedBagOStuff.php.

MemcachedBagOStuff::replace ( key,
value,
exptime = 0 
)
Parameters:
$keystring
$valueint
$exptime
Returns:
Mixed

Reimplemented from BagOStuff.

Reimplemented in MemcachedPeclBagOStuff.

Definition at line 116 of file MemcachedBagOStuff.php.

References $key, $value, encodeKey(), and fixExpiry().

MemcachedBagOStuff::set ( key,
value,
exptime = 0 
)
Parameters:
$keystring
$value
$exptimeint
Returns:
bool

Reimplemented from BagOStuff.

Reimplemented in MemcachedPeclBagOStuff.

Definition at line 73 of file MemcachedBagOStuff.php.

References $key, $value, encodeKey(), and fixExpiry().


Member Data Documentation

MemcachedBagOStuff::$client [protected]

Definition at line 30 of file MemcachedBagOStuff.php.


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