|
MediaWiki
REL1_20
|
interface is intended to be more or less compatible with the PHP memcached client. More...

Public Member Functions | |
| add ($key, $value, $exptime=0) | |
| debug ($text) | |
| decr ($key, $value=1) | |
| Decrease stored value of $key by $value while preserving its TTL. | |
| delete ($key, $time=0) | |
| Delete an item. | |
| deleteObjectsExpiringBefore ($date, $progressCallback=false) | |
| Delete all objects expiring before a certain date. | |
| get ($key) | |
| 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) | |
| Increase stored value of $key by $value while preserving its TTL. | |
| keys () | |
| lock ($key, $timeout=0) | |
| replace ($key, $value, $exptime=0) | |
| set ($key, $value, $exptime=0) | |
| Set an item. | |
| setDebug ($bool) | |
| unlock ($key) | |
Protected Member Functions | |
| convertExpiry ($exptime) | |
| Convert an optionally relative time to an absolute time. | |
| convertToRelative ($exptime) | |
| Convert an optionally absolute expiry time to a relative time. | |
| isInteger ($value) | |
| Check if a value is an integer. | |
Private Attributes | |
| $debugMode = false | |
interface is intended to be more or less compatible with the PHP memcached client.
backends for local hash array and SQL table included: $bag = new HashBagOStuff(); $bag = new SqlBagOStuff(); # connect to db first
Definition at line 43 of file BagOStuff.php.
| BagOStuff::add | ( | $ | key, |
| $ | value, | ||
| $ | exptime = 0 |
||
| ) |
| $key | string |
| $value | mixed |
| $exptime | integer |
Reimplemented in DBABagOStuff, RedisBagOStuff, MemcachedPeclBagOStuff, MultiWriteBagOStuff, and MemcachedBagOStuff.
Definition at line 146 of file BagOStuff.php.
References $value.
| BagOStuff::convertExpiry | ( | $ | exptime | ) | [protected] |
Convert an optionally relative time to an absolute time.
| $exptime | integer |
Definition at line 213 of file BagOStuff.php.
Referenced by DBABagOStuff\encode(), HashBagOStuff\set(), and EhcacheBagOStuff\set().
| BagOStuff::convertToRelative | ( | $ | exptime | ) | [protected] |
Convert an optionally absolute expiry time to a relative time.
If an absolute time is specified which is in the past, use a short expiry time.
| $exptime | integer |
Definition at line 228 of file BagOStuff.php.
Referenced by RedisBagOStuff\add(), RedisBagOStuff\replace(), and RedisBagOStuff\set().
| BagOStuff::debug | ( | $ | text | ) |
| $text | string |
Definition at line 201 of file BagOStuff.php.
References wfDebug().
Referenced by RedisBagOStuff\getConnectionToServer(), RedisBagOStuff\getMulti(), and RedisBagOStuff\logRequest().
| BagOStuff::decr | ( | $ | key, |
| $ | value = 1 |
||
| ) |
Decrease stored value of $key by $value while preserving its TTL.
| $key | String |
| $value | Integer |
Reimplemented in MemcachedPeclBagOStuff, MultiWriteBagOStuff, MemcachedPhpBagOStuff, XCacheBagOStuff, and APCBagOStuff.
Definition at line 194 of file BagOStuff.php.
| BagOStuff::delete | ( | $ | key, |
| $ | time = 0 |
||
| ) | [abstract] |
Delete an item.
| $key | string |
| $time | int Amount of time to delay the operation (mostly memcached-specific) |
Reimplemented in SqlBagOStuff, DBABagOStuff, EhcacheBagOStuff, RedisBagOStuff, MemcachedPeclBagOStuff, MultiWriteBagOStuff, HashBagOStuff, MemcachedBagOStuff, XCacheBagOStuff, WinCacheBagOStuff, APCBagOStuff, and EmptyBagOStuff.
| BagOStuff::deleteObjectsExpiringBefore | ( | $ | date, |
| $ | progressCallback = false |
||
| ) |
Delete all objects expiring before a certain date.
| $date | string The reference date in MW format |
| $progressCallback | callback|bool Optional, a function which will be called regularly during long-running operations with the percentage progress as the first parameter. |
Reimplemented in SqlBagOStuff, and MultiWriteBagOStuff.
Definition at line 117 of file BagOStuff.php.
| BagOStuff::get | ( | $ | key | ) | [abstract] |
Get an item with the given key.
Returns false if it does not exist.
| $key | string |
Reimplemented in SqlBagOStuff, DBABagOStuff, MemcachedPeclBagOStuff, RedisBagOStuff, EhcacheBagOStuff, MultiWriteBagOStuff, MemcachedBagOStuff, HashBagOStuff, WinCacheBagOStuff, XCacheBagOStuff, EmptyBagOStuff, and APCBagOStuff.
| BagOStuff::getMulti | ( | array $ | keys | ) |
Get an associative array containing the item for each of the keys that have items.
| $keys | Array List of strings |
Reimplemented in MemcachedPeclBagOStuff, SqlBagOStuff, RedisBagOStuff, and MemcachedPhpBagOStuff.
Definition at line 129 of file BagOStuff.php.
References $res.
| BagOStuff::incr | ( | $ | key, |
| $ | value = 1 |
||
| ) |
Increase stored value of $key by $value while preserving its TTL.
| $key | String: Key to increase |
| $value | Integer: Value to add to $key (Default 1) |
Reimplemented in SqlBagOStuff, RedisBagOStuff, DBABagOStuff, MemcachedPeclBagOStuff, MultiWriteBagOStuff, MemcachedPhpBagOStuff, XCacheBagOStuff, and APCBagOStuff.
Definition at line 172 of file BagOStuff.php.
References $n, $value, isInteger(), lock(), and unlock().
Referenced by decr().
| BagOStuff::isInteger | ( | $ | value | ) | [protected] |
Check if a value is an integer.
| $value | mixed |
Definition at line 246 of file BagOStuff.php.
References $value.
Referenced by APCBagOStuff\get(), XCacheBagOStuff\get(), incr(), APCBagOStuff\set(), and XCacheBagOStuff\set().
| BagOStuff::keys | ( | ) |
Reimplemented in SqlBagOStuff, DBABagOStuff, HashBagOStuff, APCBagOStuff, and WinCacheBagOStuff.
Definition at line 103 of file BagOStuff.php.
| BagOStuff::lock | ( | $ | key, |
| $ | timeout = 0 |
||
| ) |
| $key | string |
| $timeout | integer |
Reimplemented in MultiWriteBagOStuff, and MemcachedPhpBagOStuff.
Definition at line 85 of file BagOStuff.php.
Referenced by incr().
| BagOStuff::replace | ( | $ | key, |
| $ | value, | ||
| $ | exptime = 0 |
||
| ) |
| $key | string |
| $value | mixed |
| $exptime | int |
Reimplemented in RedisBagOStuff, MemcachedPeclBagOStuff, MultiWriteBagOStuff, and MemcachedBagOStuff.
Definition at line 159 of file BagOStuff.php.
References $value.
| BagOStuff::set | ( | $ | key, |
| $ | value, | ||
| $ | exptime = 0 |
||
| ) | [abstract] |
Set an item.
| $key | string |
| $value | mixed |
| $exptime | int Either an interval in seconds or a unix timestamp for expiry |
Reimplemented in SqlBagOStuff, DBABagOStuff, MemcachedPeclBagOStuff, RedisBagOStuff, EhcacheBagOStuff, MultiWriteBagOStuff, HashBagOStuff, MemcachedBagOStuff, XCacheBagOStuff, WinCacheBagOStuff, APCBagOStuff, and EmptyBagOStuff.
| BagOStuff::setDebug | ( | $ | bool | ) |
| $bool | bool |
Reimplemented in MultiWriteBagOStuff, and MemcachedPhpBagOStuff.
Definition at line 49 of file BagOStuff.php.
| BagOStuff::unlock | ( | $ | key | ) |
| $key | string |
Reimplemented in MultiWriteBagOStuff, and MemcachedPhpBagOStuff.
Definition at line 94 of file BagOStuff.php.
Referenced by incr().
BagOStuff::$debugMode = false [private] |
Definition at line 44 of file BagOStuff.php.