Public Member Functions | |
__construct ($value=false, $deps=array()) | |
Create an instance. | |
isExpired () | |
Returns true if any of the dependencies have expired. | |
initialiseDeps () | |
Initialise dependency values in preparation for storing. | |
getValue () | |
Get the user-defined value. | |
storeToCache ($cache, $key, $expiry=0) | |
Store the wrapper to a cache. | |
Static Public Member Functions | |
static | getValueFromCache ($cache, $key, $expiry=0, $callback=false, $callbackParams=array(), $deps=array()) |
Attempt to get a value from the cache. | |
Public Attributes | |
$value | |
$deps |
Users should typically only use DependencyWrapper::getFromCache(), rather than instantiating one of these objects directly.
Definition at line 8 of file CacheDependency.php.
DependencyWrapper::__construct | ( | $ | value = false , |
|
$ | deps = array() | |||
) |
Create an instance.
$value | Mixed: the user-supplied value | |
$deps | Mixed: a dependency or dependency array. All dependencies must be objects implementing CacheDependency. |
Definition at line 18 of file CacheDependency.php.
DependencyWrapper::getValue | ( | ) |
static DependencyWrapper::getValueFromCache | ( | $ | cache, | |
$ | key, | |||
$ | expiry = 0 , |
|||
$ | callback = false , |
|||
$ | callbackParams = array() , |
|||
$ | deps = array() | |||
) | [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.
$cache | Object: a cache object such as $wgMemc | |
$key | String: the cache key | |
$expiry | Integer: the expiry timestamp or interval in seconds | |
$callback | Mixed: the callback for generating the value, or false | |
$callbackParams | Array: the function parameters for the callback | |
$deps | Array: 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 80 of file CacheDependency.php.
DependencyWrapper::initialiseDeps | ( | ) |
Initialise dependency values in preparation for storing.
This must be called before serialization.
Definition at line 42 of file CacheDependency.php.
Referenced by storeToCache().
DependencyWrapper::isExpired | ( | ) |
Returns true if any of the dependencies have expired.
Definition at line 29 of file CacheDependency.php.
DependencyWrapper::storeToCache | ( | $ | cache, | |
$ | key, | |||
$ | expiry = 0 | |||
) |
Store the wrapper to a cache.
Definition at line 58 of file CacheDependency.php.
References initialiseDeps().
DependencyWrapper::$deps |
Definition at line 10 of file CacheDependency.php.
Referenced by __construct(), and getValueFromCache().
DependencyWrapper::$value |
Definition at line 9 of file CacheDependency.php.
Referenced by __construct(), and getValueFromCache().