MediaWiki  1.28.1
PoolCounterWorkViaCallback Class Reference

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

Inheritance diagram for PoolCounterWorkViaCallback:
Collaboration diagram for PoolCounterWorkViaCallback:

Public Member Functions

 __construct ($type, $key, array $callbacks)
 Build a PoolCounterWork class from a type, key, and callback map. More...
 doWork ()
 error ($status)
 fallback ()
 getCachedWork ()
- Public Member Functions inherited from PoolCounterWork
 __construct ($type, $key)
 doWork ()
 Actually perform the work, caching it if needed. More...
 error ($status)
 Do something with the error, like showing it to the user. More...
 execute ($skipcache=false)
 Get the result of the work (whatever it is), or the result of the error() function. More...
 fallback ()
 A work not so good (eg. More...
 getCachedWork ()
 Retrieve the work from cache. More...
 logError ($status)
 Log an error. More...

Protected Attributes

callable null $doCachedWork
callable $doWork
callable null $error
callable null $fallback
- Protected Attributes inherited from PoolCounterWork
bool $cacheable = false
string $type = 'generic'

Detailed Description

Convenience class for dealing with PoolCounters using callbacks.


Definition at line 28 of file PoolCounterWorkViaCallback.php.

Constructor & Destructor Documentation

PoolCounterWorkViaCallback::__construct (   $type,
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$typeThe class of actions to limit concurrency for
array$callbacksMap of callbacks

Definition at line 52 of file PoolCounterWorkViaCallback.php.

References $name, PoolCounterWork\$type, as, and doWork().

Member Function Documentation

PoolCounterWorkViaCallback::doWork ( )

Definition at line 68 of file PoolCounterWorkViaCallback.php.

Referenced by __construct().

PoolCounterWorkViaCallback::error (   $status)

Definition at line 86 of file PoolCounterWorkViaCallback.php.

References $status.

PoolCounterWorkViaCallback::fallback ( )

Definition at line 79 of file PoolCounterWorkViaCallback.php.

PoolCounterWorkViaCallback::getCachedWork ( )

Definition at line 72 of file PoolCounterWorkViaCallback.php.

Member Data Documentation

callable null PoolCounterWorkViaCallback::$doCachedWork

Definition at line 32 of file PoolCounterWorkViaCallback.php.

callable PoolCounterWorkViaCallback::$doWork

Definition at line 30 of file PoolCounterWorkViaCallback.php.

callable null PoolCounterWorkViaCallback::$error

Definition at line 36 of file PoolCounterWorkViaCallback.php.

callable null PoolCounterWorkViaCallback::$fallback

Definition at line 34 of file PoolCounterWorkViaCallback.php.

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