MediaWiki
REL1_23
|
Convenience class for dealing with PoolCounters using callbacks. More...
Public Member Functions | |
__construct ($type, $key, array $callbacks) | |
Build a PoolCounterWork class from a type, key, and callback map. | |
doWork () | |
Actually perform the work, caching it if needed. | |
error ($status) | |
Do something with the error, like showing it to the user. | |
fallback () | |
A work not so good (eg. | |
getCachedWork () | |
Retrieve the work from cache. | |
Protected Attributes | |
callable null | $doCachedWork |
* | |
callable | $doWork |
* | |
callable null | $error |
* | |
callable null | $fallback |
* |
Convenience class for dealing with PoolCounters using callbacks.
Definition at line 155 of file PoolCounterWork.php.
PoolCounterWorkViaCallback::__construct | ( | $ | type, |
$ | key, | ||
array $ | callbacks | ||
) |
Build a PoolCounterWork class from a type, key, and callback map.
The callback map must at least have a callback for the 'doWork' method. Additionally, callbacks can be provided for the 'doCachedWork', 'fallback', and 'error' methods. Methods without callbacks will be no-ops that return false. If a 'doCachedWork' callback is provided, then execute() may wait for any prior process in the pool to finish and reuse its cached result.
string | $type | |
string | $key | |
array | $callbacks | Map of callbacks |
MWException |
Definition at line 175 of file PoolCounterWork.php.
Actually perform the work, caching it if needed.
Reimplemented from PoolCounterWork.
Definition at line 191 of file PoolCounterWork.php.
Referenced by getCachedWork().
PoolCounterWorkViaCallback::error | ( | $ | status | ) |
Do something with the error, like showing it to the user.
Reimplemented from PoolCounterWork.
Definition at line 209 of file PoolCounterWork.php.
A work not so good (eg.
expired one) but better than an error message.
Reimplemented from PoolCounterWork.
Definition at line 202 of file PoolCounterWork.php.
Retrieve the work from cache.
Reimplemented from PoolCounterWork.
Definition at line 195 of file PoolCounterWork.php.
callable null PoolCounterWorkViaCallback::$doCachedWork [protected] |
*
Definition at line 157 of file PoolCounterWork.php.
callable PoolCounterWorkViaCallback::$doWork [protected] |
*
Definition at line 156 of file PoolCounterWork.php.
callable null PoolCounterWorkViaCallback::$error [protected] |
*
Definition at line 159 of file PoolCounterWork.php.
callable null PoolCounterWorkViaCallback::$fallback [protected] |
*
Definition at line 158 of file PoolCounterWork.php.