MediaWiki
REL1_21
|
Public Member Functions | |
__construct ($params) | |
Construct a RedisBagOStuff object. | |
add ($key, $value, $expiry=0) | |
cas ($casToken, $key, $value, $expiry=0) | |
Check and set an item. | |
delete ($key, $time=0) | |
Delete an item. | |
get ($key, &$casToken=null) | |
Get an item with the given key. | |
getMulti (array $keys) | |
Get an associative array containing the item for each of the keys that have items. | |
incr ($key, $value=1) | |
Non-atomic implementation of incr(). | |
logRequest ($method, $key, $server, $result) | |
Send information about a single request to the debug log. | |
replace ($key, $value, $expiry=0) | |
Non-atomic implementation of replace(). | |
set ($key, $value, $expiry=0) | |
Set an item. | |
Protected Member Functions | |
getConnection ($key) | |
Get a Redis object with a connection suitable for fetching the specified key. | |
handleException ($server, RedisConnRef $conn, $e) | |
The redis extension throws an exception in response to various read, write and protocol errors. | |
logError ($msg) | |
Log a fatal error. | |
Protected Attributes | |
bool | $automaticFailover |
* | |
RedisConnectionPool | $redisPool |
* | |
Array | $servers |
List of server names *. |
Definition at line 23 of file RedisBagOStuff.php.
RedisBagOStuff::__construct | ( | $ | params | ) |
Construct a RedisBagOStuff object.
Parameters are:
Definition at line 54 of file RedisBagOStuff.php.
RedisBagOStuff::add | ( | $ | key, |
$ | value, | ||
$ | exptime = 0 |
||
) |
$key | string |
$value | mixed |
$exptime | integer |
Reimplemented from BagOStuff.
Definition at line 212 of file RedisBagOStuff.php.
RedisBagOStuff::cas | ( | $ | casToken, |
$ | key, | ||
$ | value, | ||
$ | exptime = 0 |
||
) |
Check and set an item.
$casToken | mixed | |
$key | string | |
$value | mixed | |
int | $exptime | Either an interval in seconds or a unix timestamp for expiry |
Reimplemented from BagOStuff.
Definition at line 115 of file RedisBagOStuff.php.
RedisBagOStuff::delete | ( | $ | key, |
$ | time = 0 |
||
) |
Delete an item.
$key | string | |
int | $time | Amount of time to delay the operation (mostly memcached-specific) |
Reimplemented from BagOStuff.
Definition at line 151 of file RedisBagOStuff.php.
RedisBagOStuff::get | ( | $ | key, |
&$ | casToken = null |
||
) |
Get an item with the given key.
Returns false if it does not exist.
$key | string |
$casToken[optional] | mixed |
Reimplemented from BagOStuff.
Definition at line 71 of file RedisBagOStuff.php.
RedisBagOStuff::getConnection | ( | $ | key | ) | [protected] |
Get a Redis object with a connection suitable for fetching the specified key.
Definition at line 303 of file RedisBagOStuff.php.
RedisBagOStuff::getMulti | ( | array $ | keys | ) |
Get an associative array containing the item for each of the keys that have items.
array | $keys | List of strings |
Reimplemented from BagOStuff.
Definition at line 171 of file RedisBagOStuff.php.
RedisBagOStuff::handleException | ( | $ | server, |
RedisConnRef $ | conn, | ||
$ | e | ||
) | [protected] |
The redis extension throws an exception in response to various read, write and protocol errors.
Sometimes it also closes the connection, sometimes not. The safest response for us is to explicitly destroy the connection object and let it be reopened during the next request.
Definition at line 336 of file RedisBagOStuff.php.
RedisBagOStuff::incr | ( | $ | key, |
$ | value = 1 |
||
) |
Non-atomic implementation of incr().
Probably all callers actually want incr() to atomically initialise values to zero if they don't exist, as provided by the Redis INCR command. But we are constrained by the memcached-like interface to return null in that case. Once the key exists, further increments are atomic.
Reimplemented from BagOStuff.
Definition at line 276 of file RedisBagOStuff.php.
RedisBagOStuff::logError | ( | $ | msg | ) | [protected] |
Log a fatal error.
Definition at line 326 of file RedisBagOStuff.php.
RedisBagOStuff::logRequest | ( | $ | method, |
$ | key, | ||
$ | server, | ||
$ | result | ||
) |
Send information about a single request to the debug log.
Definition at line 343 of file RedisBagOStuff.php.
RedisBagOStuff::replace | ( | $ | key, |
$ | value, | ||
$ | expiry = 0 |
||
) |
Non-atomic implementation of replace().
Could perhaps be done atomically with WATCH or scripting, but this function is rarely used.
Reimplemented from BagOStuff.
Definition at line 238 of file RedisBagOStuff.php.
RedisBagOStuff::set | ( | $ | key, |
$ | value, | ||
$ | exptime = 0 |
||
) |
Set an item.
$key | string | |
$value | mixed | |
int | $exptime | Either an interval in seconds or a unix timestamp for expiry |
Reimplemented from BagOStuff.
Definition at line 90 of file RedisBagOStuff.php.
bool RedisBagOStuff::$automaticFailover [protected] |
*
Definition at line 26 of file RedisBagOStuff.php.
RedisConnectionPool RedisBagOStuff::$redisPool [protected] |
*
Definition at line 24 of file RedisBagOStuff.php.
Array RedisBagOStuff::$servers [protected] |
List of server names *.
Definition at line 25 of file RedisBagOStuff.php.