MediaWiki
REL1_22
|
Class to store objects in the database. More...
Public Member Functions | |
__construct ($params) | |
Constructor. | |
cas ($casToken, $key, $value, $exptime=0) | |
createTables () | |
Create shard tables. | |
delete ($key, $time=0) | |
deleteAll () | |
deleteObjectsExpiringBefore ($timestamp, $progressCallback=false) | |
Delete objects from the database which expire before a certain date. | |
expireAll () | |
get ($key, &$casToken=null) | |
getMulti (array $keys) | |
incr ($key, $step=1) | |
set ($key, $value, $exptime=0) | |
Public Attributes | |
$conns | |
$lastExpireAll = 0 | |
LoadBalancer | $lb |
$numServers | |
$purgePeriod = 100 | |
$serverInfos | |
$serverNames | |
$shards = 1 | |
$tableName = 'objectcache' | |
Protected Member Functions | |
garbageCollect () | |
getDB ($serverIndex) | |
Get a connection to the specified database. | |
getMaxDateTime ($db) | |
getTableByKey ($key) | |
Get the server index and table name for a given key. | |
getTableNameByShard ($index) | |
Get the table name for a given shard index. | |
handleReadError (DBError $exception, $serverIndex) | |
Handle a DBError which occurred during a read operation. | |
handleWriteError (DBError $exception, $serverIndex) | |
Handle a DBQueryError which occurred during a write operation. | |
isExpired ($db, $exptime) | |
markServerDown ($exception, $serverIndex) | |
Mark a server down due to a DBConnectionError exception. | |
serialize (&$data) | |
Serialize an object and, if possible, compress the representation. | |
unserialize ($serial) | |
Unserialize and, if necessary, decompress an object. | |
Protected Attributes | |
$connFailureErrors = array() | |
$connFailureTimes = array() |
Class to store objects in the database.
Definition at line 29 of file SqlBagOStuff.php.
SqlBagOStuff::__construct | ( | $ | params | ) |
Constructor.
Parameters are:
$params | array |
Definition at line 74 of file SqlBagOStuff.php.
SqlBagOStuff::cas | ( | $ | casToken, |
$ | key, | ||
$ | value, | ||
$ | exptime = 0 |
||
) |
$casToken | mixed |
$key | string |
$value | mixed |
$exptime | int |
Reimplemented from BagOStuff.
Definition at line 325 of file SqlBagOStuff.php.
SqlBagOStuff::delete | ( | $ | key, |
$ | time = 0 |
||
) |
$key | string |
$time | int |
Reimplemented from BagOStuff.
Definition at line 374 of file SqlBagOStuff.php.
Definition at line 563 of file SqlBagOStuff.php.
References getDB(), getTableNameByShard(), and handleWriteError().
SqlBagOStuff::deleteObjectsExpiringBefore | ( | $ | timestamp, |
$ | progressCallback = false |
||
) |
Delete objects from the database which expire before a certain date.
$timestamp | string |
$progressCallback | bool|callback |
Reimplemented from BagOStuff.
Definition at line 491 of file SqlBagOStuff.php.
Referenced by expireAll().
Definition at line 481 of file SqlBagOStuff.php.
References deleteObjectsExpiringBefore(), and wfTimestampNow().
Referenced by garbageCollect().
SqlBagOStuff::garbageCollect | ( | ) | [protected] |
Definition at line 464 of file SqlBagOStuff.php.
References expireAll().
SqlBagOStuff::get | ( | $ | key, |
&$ | casToken = null |
||
) |
$key | string |
$casToken[optional] | mixed |
Reimplemented from BagOStuff.
Definition at line 198 of file SqlBagOStuff.php.
SqlBagOStuff::getDB | ( | $ | serverIndex | ) | [protected] |
Get a connection to the specified database.
$serverIndex | integer |
Definition at line 106 of file SqlBagOStuff.php.
Referenced by deleteAll().
SqlBagOStuff::getMaxDateTime | ( | $ | db | ) | [protected] |
Definition at line 456 of file SqlBagOStuff.php.
SqlBagOStuff::getMulti | ( | array $ | keys | ) |
$keys | array |
Reimplemented from BagOStuff.
Definition at line 211 of file SqlBagOStuff.php.
SqlBagOStuff::getTableByKey | ( | $ | key | ) | [protected] |
Get the server index and table name for a given key.
$key | string |
Definition at line 160 of file SqlBagOStuff.php.
SqlBagOStuff::getTableNameByShard | ( | $ | index | ) | [protected] |
Get the table name for a given shard index.
$index | int |
Definition at line 183 of file SqlBagOStuff.php.
Referenced by deleteAll().
SqlBagOStuff::handleReadError | ( | DBError $ | exception, |
$ | serverIndex | ||
) | [protected] |
Handle a DBError which occurred during a read operation.
Definition at line 622 of file SqlBagOStuff.php.
SqlBagOStuff::handleWriteError | ( | DBError $ | exception, |
$ | serverIndex | ||
) | [protected] |
Handle a DBQueryError which occurred during a write operation.
Definition at line 637 of file SqlBagOStuff.php.
Referenced by deleteAll().
SqlBagOStuff::incr | ( | $ | key, |
$ | step = 1 |
||
) |
$key | string |
$step | int |
Reimplemented from BagOStuff.
Definition at line 397 of file SqlBagOStuff.php.
SqlBagOStuff::isExpired | ( | $ | db, |
$ | exptime | ||
) | [protected] |
SqlBagOStuff::markServerDown | ( | $ | exception, |
$ | serverIndex | ||
) | [protected] |
Mark a server down due to a DBConnectionError exception.
Definition at line 657 of file SqlBagOStuff.php.
SqlBagOStuff::serialize | ( | &$ | data | ) | [protected] |
Serialize an object and, if possible, compress the representation.
On typical message and page data, this can provide a 3X decrease in storage requirements.
$data | mixed |
Definition at line 588 of file SqlBagOStuff.php.
SqlBagOStuff::set | ( | $ | key, |
$ | value, | ||
$ | exptime = 0 |
||
) |
$key | string |
$value | mixed |
$exptime | int |
Reimplemented from BagOStuff.
Definition at line 279 of file SqlBagOStuff.php.
SqlBagOStuff::unserialize | ( | $ | serial | ) | [protected] |
Unserialize and, if necessary, decompress an object.
$serial | string |
Definition at line 603 of file SqlBagOStuff.php.
SqlBagOStuff::$connFailureErrors = array() [protected] |
Definition at line 44 of file SqlBagOStuff.php.
SqlBagOStuff::$connFailureTimes = array() [protected] |
Definition at line 43 of file SqlBagOStuff.php.
SqlBagOStuff::$conns |
Definition at line 37 of file SqlBagOStuff.php.
SqlBagOStuff::$lastExpireAll = 0 |
Definition at line 38 of file SqlBagOStuff.php.
LoadBalancer SqlBagOStuff::$lb |
Definition at line 32 of file SqlBagOStuff.php.
SqlBagOStuff::$numServers |
Definition at line 36 of file SqlBagOStuff.php.
SqlBagOStuff::$purgePeriod = 100 |
Definition at line 39 of file SqlBagOStuff.php.
SqlBagOStuff::$serverInfos |
Definition at line 34 of file SqlBagOStuff.php.
SqlBagOStuff::$serverNames |
Definition at line 35 of file SqlBagOStuff.php.
SqlBagOStuff::$shards = 1 |
Definition at line 40 of file SqlBagOStuff.php.
SqlBagOStuff::$tableName = 'objectcache' |
Definition at line 41 of file SqlBagOStuff.php.