MediaWiki  REL1_24
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.
 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:
string$key
int$value
int$exptime(default 0)
Returns:
mixed

Reimplemented from BagOStuff.

Reimplemented in MemcachedPeclBagOStuff.

Definition at line 107 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.

Parameters:
array$params
Returns:
array

Definition at line 38 of file MemcachedBagOStuff.php.

References $GLOBALS, and $params.

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

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

Reimplemented from BagOStuff.

Reimplemented in MemcachedPeclBagOStuff.

Definition at line 87 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:
string$key
Returns:
string

Definition at line 168 of file MemcachedBagOStuff.php.

References $key.

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

Reimplemented from BagOStuff.

Reimplemented in MemcachedPeclBagOStuff.

Definition at line 97 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:
string$key
Returns:
string

Definition at line 131 of file MemcachedBagOStuff.php.

References $key, and array().

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

Parameters:
array$m
Returns:
string

Definition at line 140 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)

Parameters:
int$expiry
Returns:
int

Definition at line 153 of file MemcachedBagOStuff.php.

Referenced by add(), cas(), set(), and MemcachedPeclBagOStuff\setMulti().

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

Reimplemented from BagOStuff.

Reimplemented in MemcachedPeclBagOStuff.

Definition at line 65 of file MemcachedBagOStuff.php.

References $key, and encodeKey().

Get the underlying client object.

This is provided for debugging purposes.

Returns:
BagOStuff

Definition at line 117 of file MemcachedBagOStuff.php.

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

Reimplemented from BagOStuff.

Reimplemented in MemcachedPeclBagOStuff.

Definition at line 75 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: