MediaWiki  REL1_19
DependencyWrapper Class Reference

This class stores an arbitrary value along with its dependencies. More...

List of all members.

Public Member Functions

 __construct ($value=false, $deps=array())
 Create an instance.
 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=array(), $deps=array())
 Attempt to get a value from the cache.

Public Attributes

 $deps
 $value

Detailed Description

This class stores an arbitrary value along with its dependencies.

Users should typically only use DependencyWrapper::getValueFromCache(), rather than instantiating one of these objects directly.

Definition at line 9 of file CacheDependency.php.


Constructor & Destructor Documentation

DependencyWrapper::__construct ( value = false,
deps = array() 
)

Create an instance.

Parameters:
$valueMixed: the user-supplied value
$depsMixed: a dependency or dependency array. All dependencies must be objects implementing CacheDependency.

Definition at line 19 of file CacheDependency.php.

References $deps, and $value.


Member Function Documentation

Get the user-defined value.

Returns:
bool|

Definition at line 58 of file CacheDependency.php.

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.

Parameters:
$cacheBagOStuff a cache object such as $wgMemc
$keyString: the cache key
$expiryInteger: the expiry timestamp or interval in seconds
$callbackMixed: the callback for generating the value, or false
$callbackParamsArray: the function parameters for the callback
$depsArray: 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.
Returns:
mixed The value, or null if it was not present in the cache and no callback was defined.

Definition at line 91 of file CacheDependency.php.

References $deps, $value, and isExpired().

Here is the call graph for this function:

Initialise dependency values in preparation for storing.

This must be called before serialization.

Definition at line 48 of file CacheDependency.php.

Referenced by storeToCache().

Here is the caller graph for this function:

Returns true if any of the dependencies have expired.

Returns:
bool

Definition at line 34 of file CacheDependency.php.

Referenced by getValueFromCache().

Here is the caller graph for this function:

DependencyWrapper::storeToCache ( cache,
key,
expiry = 0 
)

Store the wrapper to a cache.

Parameters:
$cacheBagOStuff
$key
$expiry

Definition at line 69 of file CacheDependency.php.

References initialiseDeps().

Here is the call graph for this function:


Member Data Documentation

DependencyWrapper::$deps

Definition at line 11 of file CacheDependency.php.

Referenced by __construct(), and getValueFromCache().

DependencyWrapper::$value

Definition at line 10 of file CacheDependency.php.

Referenced by __construct(), and getValueFromCache().


The documentation for this class was generated from the following file: