MediaWiki REL1_40
|
Class for dealing with PoolCounters using class members. More...
Inherited by PoolCounterWorkViaCallback, and PoolWorkArticleView.
Public Member Functions | |
__construct (string $type, string $key, PoolCounter $poolCounter=null) | |
doWork () | |
Actually perform the work, caching it if needed. | |
error ( $status) | |
Do something with the error, like showing it to the user. | |
execute ( $skipcache=false) | |
Get the result of the work (whatever it is), or the result of the error() function. | |
fallback ( $fast) | |
A work not so good (eg. | |
getCachedWork () | |
Retrieve the work from cache. | |
logError ( $status) | |
Log an error. | |
Protected Member Functions | |
isFastStaleEnabled () | |
Should fast stale mode be used? | |
Protected Attributes | |
bool | $cacheable = false |
string | $type = 'generic' |
Class for dealing with PoolCounters using class members.
Definition at line 26 of file PoolCounterWork.php.
PoolCounterWork::__construct | ( | string | $type, |
string | $key, | ||
PoolCounter | $poolCounter = null ) |
string | $type | The class of actions to limit concurrency for (task type) |
string | $key | Key that identifies the queue this work is placed on |
PoolCounter | null | $poolCounter |
Definition at line 39 of file PoolCounterWork.php.
References $type.
|
abstract |
Actually perform the work, caching it if needed.
Reimplemented in PoolCounterWorkViaCallback, PoolWorkArticleView, PoolWorkArticleViewCurrent, and PoolWorkArticleViewOld.
Referenced by execute().
PoolCounterWork::error | ( | $status | ) |
Do something with the error, like showing it to the user.
Status | $status |
Reimplemented in PoolCounterWorkViaCallback, and PoolWorkArticleView.
Definition at line 79 of file PoolCounterWork.php.
Referenced by execute().
PoolCounterWork::execute | ( | $skipcache = false | ) |
Get the result of the work (whatever it is), or the result of the error() function.
This returns the result of the one of the following methods:
If these all return false, then the result of error() is returned.
In slow-stale mode, these three methods are called in the sequence given above, and the first non-false response is used. This means in case of concurrent cache-miss requests for the same revision, later ones will load on DBs and other backend services, and wait for earlier requests to succeed and then read out their saved result.
In fast-stale mode, if other requests hold doWork lock already, we call fallback() first to let it try to find an acceptable return value. If fallback() returns false, then we will wait for the doWork lock, as for slow stale mode, including potentially calling fallback() a second time.
bool | $skipcache |
Definition at line 132 of file PoolCounterWork.php.
References PoolCounter\DONE, doWork(), PoolCounter\ERROR, error(), execute(), fallback(), getCachedWork(), isFastStaleEnabled(), PoolCounter\LOCK_HELD, PoolCounter\LOCKED, logError(), PoolCounter\QUEUE_FULL, and PoolCounter\TIMEOUT.
Referenced by DjVuHandler\doTransform(), SpecialContributions\execute(), execute(), File\getThumbnailSource(), and wfGenerateThumbnail().
PoolCounterWork::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 in PoolCounterWorkViaCallback, and PoolWorkArticleViewCurrent.
Definition at line 69 of file PoolCounterWork.php.
Referenced by execute().
PoolCounterWork::getCachedWork | ( | ) |
Retrieve the work from cache.
Reimplemented in PoolCounterWorkViaCallback, PoolWorkArticleViewCurrent, and PoolWorkArticleViewOld.
Definition at line 58 of file PoolCounterWork.php.
Referenced by execute().
|
protected |
Should fast stale mode be used?
Definition at line 88 of file PoolCounterWork.php.
Referenced by execute().
PoolCounterWork::logError | ( | $status | ) |
Log an error.
Status | $status |
Definition at line 98 of file PoolCounterWork.php.
References wfDebugLog().
Referenced by execute().
|
protected |
Definition at line 30 of file PoolCounterWork.php.
Referenced by PoolWorkArticleViewCurrent\__construct().
|
protected |
Definition at line 28 of file PoolCounterWork.php.
Referenced by PoolCounterWorkViaCallback\__construct().