MediaWiki  REL1_22
PoolCounterWorkViaCallback Class Reference

Convenience class for dealing with PoolCounters using callbacks. More...

Inheritance diagram for PoolCounterWorkViaCallback:
Collaboration diagram for PoolCounterWorkViaCallback:

List of all members.

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
 *

Detailed Description

Convenience class for dealing with PoolCounters using callbacks.

Since:
1.22

Definition at line 262 of file PoolCounter.php.


Constructor & Destructor Documentation

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.

Parameters:
string$type
string$key
array$callbacksMap of callbacks
Exceptions:
MWException

Definition at line 282 of file PoolCounter.php.


Member Function Documentation

Actually perform the work, caching it if needed.

Returns:
mixed work result or false

Reimplemented from PoolCounterWork.

Definition at line 298 of file PoolCounter.php.

Do something with the error, like showing it to the user.

Returns:
bool

Reimplemented from PoolCounterWork.

Definition at line 316 of file PoolCounter.php.

References array(), and fallback().

A work not so good (eg.

expired one) but better than an error message.

Returns:
mixed work result or false

Reimplemented from PoolCounterWork.

Definition at line 309 of file PoolCounter.php.

References array().

Referenced by error().

Retrieve the work from cache.

Returns:
mixed work result or false

Reimplemented from PoolCounterWork.

Definition at line 302 of file PoolCounter.php.


Member Data Documentation

callable null PoolCounterWorkViaCallback::$doCachedWork [protected]

*

Definition at line 264 of file PoolCounter.php.

callable PoolCounterWorkViaCallback::$doWork [protected]

*

Definition at line 263 of file PoolCounter.php.

callable null PoolCounterWorkViaCallback::$error [protected]

*

Definition at line 266 of file PoolCounter.php.

callable null PoolCounterWorkViaCallback::$fallback [protected]

*

Definition at line 265 of file PoolCounter.php.


The documentation for this class was generated from the following file: