[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/poolcounter/ -> PoolCounterWork.php (summary)

Provides of semaphore semantics for restricting the number of workers that may be concurrently performing the same task. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 160 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 6 functions

  __construct()
  getCachedWork()
  fallback()
  error()
  logError()
  execute()

Functions
Functions that are not part of a class:

__construct( $type, $key )   X-Ref

param: string $type The type of PoolCounter to use
param: string $key Key that identifies the queue this work is placed on

getCachedWork()   X-Ref
Retrieve the work from cache

return: mixed Work result or false

fallback()   X-Ref
A work not so good (eg. expired one) but better than an error
message.

return: mixed Work result or false

error( $status )   X-Ref
Do something with the error, like showing it to the user.

param: Status $status
return: bool

logError( $status )   X-Ref
Log an error

param: Status $status
return: void

execute( $skipcache = false )   X-Ref
Get the result of the work (whatever it is), or the result of the error() function.
This returns the result of the first applicable method that returns a non-false value,
where the methods are checked in the following order:
- a) doWork()       : Applies if the work is exclusive or no another process
is doing it, and on the condition that either this process
successfully entered the pool or the pool counter is down.
- b) doCachedWork() : Applies if the work is cacheable and this blocked on another
process which finished the work.
- c) fallback()     : Applies for all remaining cases.
If these all fall through (by returning false), then the result of error() is returned.

param: bool $skipcache
return: mixed



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1