MediaWiki
REL1_24
|
Base class for memcached clients. More...
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 |
Base class for memcached clients.
Definition at line 29 of file MemcachedBagOStuff.php.
MemcachedBagOStuff::add | ( | $ | key, |
$ | value, | ||
$ | exptime = 0 |
||
) |
string | $key | |
int | $value | |
int | $exptime | (default 0) |
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.
array | $params |
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 |
||
) |
mixed | $casToken | |
string | $key | |
mixed | $value | |
int | $exptime |
Reimplemented from BagOStuff.
Reimplemented in MemcachedPeclBagOStuff.
Definition at line 87 of file MemcachedBagOStuff.php.
References $key, $value, encodeKey(), and fixExpiry().
MemcachedBagOStuff::debugLog | ( | $ | text | ) | [protected] |
Send a debug message to the log.
string | $text |
Definition at line 176 of file MemcachedBagOStuff.php.
References wfDebugLog().
Referenced by MemcachedPeclBagOStuff\add(), MemcachedPeclBagOStuff\cas(), MemcachedPeclBagOStuff\checkResult(), MemcachedPeclBagOStuff\decr(), MemcachedPeclBagOStuff\delete(), MemcachedPeclBagOStuff\get(), MemcachedPeclBagOStuff\getMulti(), MemcachedPeclBagOStuff\incr(), MemcachedPeclBagOStuff\set(), and MemcachedPeclBagOStuff\setMulti().
MemcachedBagOStuff::decodeKey | ( | $ | key | ) |
Decode a key encoded with encodeKey().
This is provided as a convenience function for debugging.
string | $key |
Definition at line 168 of file MemcachedBagOStuff.php.
References $key.
MemcachedBagOStuff::delete | ( | $ | key, |
$ | time = 0 |
||
) |
string | $key | |
int | $time |
Reimplemented from BagOStuff.
Reimplemented in MemcachedPeclBagOStuff.
Definition at line 97 of file MemcachedBagOStuff.php.
References $key, $time, and encodeKey().
MemcachedBagOStuff::encodeKey | ( | $ | key | ) |
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.
string | $key |
Definition at line 131 of file MemcachedBagOStuff.php.
Referenced by add(), cas(), MemcachedPhpBagOStuff\decr(), delete(), get(), MemcachedPeclBagOStuff\get(), MemcachedPhpBagOStuff\incr(), MemcachedPhpBagOStuff\lock(), set(), MemcachedPeclBagOStuff\setMulti(), and MemcachedPhpBagOStuff\unlock().
MemcachedBagOStuff::encodeKeyCallback | ( | $ | m | ) | [protected] |
MemcachedBagOStuff::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.
Clamp expiries >30d at 30d, unless they're >=1e9 in which case they are likely to really be absolute (1e9 = 2011-09-09)
int | $expiry |
Definition at line 153 of file MemcachedBagOStuff.php.
Referenced by add(), cas(), set(), and MemcachedPeclBagOStuff\setMulti().
MemcachedBagOStuff::get | ( | $ | key, |
&$ | casToken = null |
||
) |
string | $key | |
mixed | $casToken | [optional] |
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.
Definition at line 117 of file MemcachedBagOStuff.php.
MemcachedBagOStuff::set | ( | $ | key, |
$ | value, | ||
$ | exptime = 0 |
||
) |
string | $key | |
mixed | $value | |
int | $exptime |
Reimplemented from BagOStuff.
Reimplemented in MemcachedPeclBagOStuff.
Definition at line 75 of file MemcachedBagOStuff.php.
References $key, $value, encodeKey(), and fixExpiry().
MemcachedBagOStuff::$client [protected] |
Definition at line 30 of file MemcachedBagOStuff.php.