|
MediaWiki master
|
Convenience class for dealing with PoolCounter using callbacks. More...
Inherits MediaWiki\PoolCounter\PoolCounterWork.

Public Member Functions | ||||
| __construct ( $pool, string $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 ( $fast) | ||||
A work not so good (eg.expired one) but better than an error message.
| ||||
| getCachedWork () | ||||
Retrieve the work from cache.
| ||||
Public Member Functions inherited from MediaWiki\PoolCounter\PoolCounterWork | ||||
| __construct (string $type, string $key, ?PoolCounter $poolCounter=null) | ||||
| execute ( $skipcache=false) | ||||
| Get the result of the work (whatever it is), or the result of the error() function. | ||||
| logError ( $status) | ||||
| Log an error. | ||||
Protected Attributes | |
| callable null | $doCachedWork |
| callable null | $doWork |
| callable null | $error |
| callable null | $fallback |
Protected Attributes inherited from MediaWiki\PoolCounter\PoolCounterWork | |
| bool | $cacheable = false |
| string | $type = 'generic' |
Additional Inherited Members | |
Protected Member Functions inherited from MediaWiki\PoolCounter\PoolCounterWork | |
| isFastStaleEnabled () | |
| Should fast stale mode be used? | |
Convenience class for dealing with PoolCounter using callbacks.
Definition at line 18 of file PoolCounterWorkViaCallback.php.
| MediaWiki\PoolCounter\PoolCounterWorkViaCallback::__construct | ( | $pool, | |
| string | $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.
| PoolCounter | string | $pool | The PoolCounter or PoolCounter type |
| string | $key | |
| array | $callbacks | Map of callbacks |
Definition at line 42 of file PoolCounterWorkViaCallback.php.
References MediaWiki\PoolCounter\PoolCounterWork\$type, and MediaWiki\PoolCounter\PoolCounterWorkViaCallback\doWork().
| MediaWiki\PoolCounter\PoolCounterWorkViaCallback::doWork | ( | ) |
Actually perform the work, caching it if needed.
Reimplemented from MediaWiki\PoolCounter\PoolCounterWork.
Definition at line 67 of file PoolCounterWorkViaCallback.php.
References MediaWiki\PoolCounter\PoolCounterWorkViaCallback\doWork().
Referenced by MediaWiki\PoolCounter\PoolCounterWorkViaCallback\__construct(), and MediaWiki\PoolCounter\PoolCounterWorkViaCallback\doWork().
| MediaWiki\PoolCounter\PoolCounterWorkViaCallback::error | ( | $status | ) |
Do something with the error, like showing it to the user.
| Status | $status |
Reimplemented from MediaWiki\PoolCounter\PoolCounterWork.
Definition at line 88 of file PoolCounterWorkViaCallback.php.
References MediaWiki\PoolCounter\PoolCounterWorkViaCallback\error().
Referenced by MediaWiki\PoolCounter\PoolCounterWorkViaCallback\error().
| MediaWiki\PoolCounter\PoolCounterWorkViaCallback::fallback | ( | $fast | ) |
A work not so good (eg.expired one) but better than an error message.
| bool | $fast | True if PoolCounter is requesting a fast stale response (pre-wait) |
Reimplemented from MediaWiki\PoolCounter\PoolCounterWork.
Definition at line 80 of file PoolCounterWorkViaCallback.php.
References MediaWiki\PoolCounter\PoolCounterWorkViaCallback\fallback().
Referenced by MediaWiki\PoolCounter\PoolCounterWorkViaCallback\fallback().
| MediaWiki\PoolCounter\PoolCounterWorkViaCallback::getCachedWork | ( | ) |
Retrieve the work from cache.
Reimplemented from MediaWiki\PoolCounter\PoolCounterWork.
Definition at line 72 of file PoolCounterWorkViaCallback.php.
|
protected |
Definition at line 22 of file PoolCounterWorkViaCallback.php.
|
protected |
Definition at line 20 of file PoolCounterWorkViaCallback.php.
|
protected |
Definition at line 26 of file PoolCounterWorkViaCallback.php.
|
protected |
Definition at line 24 of file PoolCounterWorkViaCallback.php.