Moodle  2.2.1
http://www.collinsharper.com
navigation_cache Class Reference

Public Member Functions

 __construct ($area, $timeout=1800)
 __get ($key)
 __set ($key, $information)
 set ($key, $information)
 cached ($key)
 compare ($key, $value, $serialise=true)
 clear ()
 volatile ($setting=true)

Static Public Member Functions

static destroy_volatile_caches ()

Data Fields

const CACHETIME = 0
const CACHEUSERID = 1
const CACHEVALUE = 2

Static Public Attributes

static $volatilecaches

Protected Member Functions

 ensure_session_cache_initialised ()
 garbage_collection ()

Protected Attributes

 $creation
 $session
 $area
 $timeout
 $currentcontext

Detailed Description

Definition at line 4113 of file navigationlib.php.


Constructor & Destructor Documentation

__construct ( area,
timeout = 1800 
)

Contructor for the cache. Requires two arguments

Parameters:
string$areaThe string to use to segregate this particular cache it can either be unique to start a fresh cache or if you want to share a cache then make it the string used in the original cache
int$timeoutThe number of seconds to time the information out after

Definition at line 4142 of file navigationlib.php.

Here is the call graph for this function:


Member Function Documentation

__get ( key)

Magic Method to retrieve something by simply calling using = cache->key

Parameters:
mixed$keyThe identifier for the information you want out again
Returns:
void|mixed Either void or what ever was put in

Definition at line 4176 of file navigationlib.php.

__set ( key,
information 
)

Magic method that simply uses set(); to store something in the cache

Parameters:
string | int$key
mixed$information

Definition at line 4190 of file navigationlib.php.

cached ( key)

Check the existence of the identifier in the cache

Parameters:
string | int$key
Returns:
bool

Definition at line 4212 of file navigationlib.php.

clear ( )

Wipes the entire cache, good to force regeneration

Definition at line 4244 of file navigationlib.php.

compare ( key,
value,
serialise = true 
)

Compare something to it's equivilant in the cache

Parameters:
string$key
mixed$value
bool$serialiseWhether to serialise the value before comparison this should only be set to false if the value is already serialised
Returns:
bool If the value is the same false if it is not set or doesn't match

Definition at line 4230 of file navigationlib.php.

static destroy_volatile_caches ( ) [static]

Destroys all caches marked as volatile

This function is static and works in conjunction with the static volatilecaches property of navigation cache. Because this function is static it manually resets the cached areas back to an empty array.

Definition at line 4293 of file navigationlib.php.

Here is the caller graph for this function:

Used to set up the cache within the SESSION.

This is called for each access and ensure that we don't put anything into the session before it is required.

Definition at line 4157 of file navigationlib.php.

garbage_collection ( ) [protected]

Checks all cache entries and removes any that have expired, good ole cleanup

Definition at line 4252 of file navigationlib.php.

Here is the caller graph for this function:

set ( key,
information 
)

Sets some information against the cache (session) for later retrieval

Parameters:
string | int$key
mixed$information

Definition at line 4200 of file navigationlib.php.

volatile ( setting = true)

Marks the cache as being volatile (likely to change)

Any caches marked as volatile will be destroyed at the on shutdown by navigation_node::destroy_volatile_caches() which is registered as a shutdown function if any caches are marked as volatile.

Parameters:
bool$settingTrue to destroy the cache false not too

Definition at line 4272 of file navigationlib.php.


Field Documentation

$area [protected]

Definition at line 4119 of file navigationlib.php.

$creation [protected]

Definition at line 4115 of file navigationlib.php.

$currentcontext [protected]

Definition at line 4123 of file navigationlib.php.

$session [protected]

Definition at line 4117 of file navigationlib.php.

$timeout [protected]

Definition at line 4121 of file navigationlib.php.

$volatilecaches [static]

Definition at line 4131 of file navigationlib.php.

const CACHETIME = 0

Definition at line 4125 of file navigationlib.php.

const CACHEUSERID = 1

Definition at line 4127 of file navigationlib.php.

const CACHEVALUE = 2

Definition at line 4129 of file navigationlib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations