MediaWiki  1.23.14
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 ()
 Actually perform the work, caching it if needed. More...
 
 error ( $status)
 Do something with the error, like showing it to the user. More...
 
 fallback ()
 A work not so good (eg. More...
 
 getCachedWork ()
 Retrieve the work from cache. More...
 
- Public Member Functions inherited from PoolCounterWork
 __construct ( $type, $key)
 
 execute ( $skipcache=false)
 Get the result of the work (whatever it is), or the result of the error() function. 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
 $cacheable = false
 

Detailed Description

Convenience class for dealing with PoolCounters using callbacks.

Since
1.22

Definition at line 155 of file PoolCounterWork.php.

Constructor & Destructor Documentation

◆ __construct()

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 175 of file PoolCounterWork.php.

References $name, $type, array(), as, and doWork().

Member Function Documentation

◆ doWork()

PoolCounterWorkViaCallback::doWork ( )

Actually perform the work, caching it if needed.

Returns
mixed work result or false

Reimplemented from PoolCounterWork.

Definition at line 191 of file PoolCounterWork.php.

References array().

Referenced by __construct().

◆ error()

PoolCounterWorkViaCallback::error (   $status)

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

Returns
bool

Reimplemented from PoolCounterWork.

Definition at line 209 of file PoolCounterWork.php.

References array().

◆ fallback()

PoolCounterWorkViaCallback::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 202 of file PoolCounterWork.php.

References array().

◆ getCachedWork()

PoolCounterWorkViaCallback::getCachedWork ( )

Retrieve the work from cache.

Returns
mixed work result or false

Reimplemented from PoolCounterWork.

Definition at line 195 of file PoolCounterWork.php.

References array().

Member Data Documentation

◆ $doCachedWork

callable null PoolCounterWorkViaCallback::$doCachedWork
protected

Definition at line 157 of file PoolCounterWork.php.

◆ $doWork

callable PoolCounterWorkViaCallback::$doWork
protected

Definition at line 156 of file PoolCounterWork.php.

◆ $error

callable null PoolCounterWorkViaCallback::$error
protected

Definition at line 159 of file PoolCounterWork.php.

◆ $fallback

callable null PoolCounterWorkViaCallback::$fallback
protected

Definition at line 158 of file PoolCounterWork.php.


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