MediaWiki REL1_40
|
Store an arbitrary value whilst representing several CacheDependency objects as one. More...
Public Member Functions | |
__construct ( $value=false, $deps=[]) | |
getValue () | |
Get the user-defined value. | |
initialiseDeps () | |
Initialise dependency values in preparation for storing. | |
isExpired () | |
Returns true if any of the dependencies have expired. | |
storeToCache ( $cache, $key, $expiry=0) | |
Store the wrapper to a cache. | |
Static Public Member Functions | |
static | getValueFromCache ( $cache, $key, $expiry=0, $callback=false, $callbackParams=[], $deps=[]) |
Attempt to get a value from the cache. | |
Store an arbitrary value whilst representing several CacheDependency objects as one.
You should typically only use DependencyWrapper::getValueFromCache(), rather than instantiating one of these objects directly.
Definition at line 29 of file DependencyWrapper.php.
DependencyWrapper::__construct | ( | $value = false, | |
$deps = [] ) |
mixed | $value | The user-supplied value |
CacheDependency | CacheDependency[] | $deps | A dependency or dependency array. All dependencies must be objects implementing CacheDependency. |
Definition at line 39 of file DependencyWrapper.php.
DependencyWrapper::getValue | ( | ) |
|
static |
Attempt to get a value from the cache.
If the value is expired or missing, it will be generated with the callback function (if present), and the newly calculated value will be stored to the cache in a wrapper.
BagOStuff | $cache | |
string | $key | The cache key |
int | $expiry | The expiry timestamp or interval in seconds |
callable | false | $callback | The callback for generating the value, or false |
array | $callbackParams | The function parameters for the callback |
array | $deps | The dependencies to store on a cache miss. Note: these are not the dependencies used on a cache hit! Cache hits use the stored dependency array. |
Definition at line 111 of file DependencyWrapper.php.
References isExpired().
DependencyWrapper::initialiseDeps | ( | ) |
Initialise dependency values in preparation for storing.
This must be called before serialization.
Definition at line 68 of file DependencyWrapper.php.
Referenced by storeToCache().
DependencyWrapper::isExpired | ( | ) |
Returns true if any of the dependencies have expired.
Definition at line 54 of file DependencyWrapper.php.
Referenced by getValueFromCache().
DependencyWrapper::storeToCache | ( | $cache, | |
$key, | |||
$expiry = 0 ) |
Store the wrapper to a cache.
BagOStuff | $cache | |
string | $key | |
int | $expiry |
Definition at line 89 of file DependencyWrapper.php.
References initialiseDeps().