Non-volatile cache storage


Functions

 views_object_cache_get ($obj, $name, $skip_cache=FALSE)
 views_object_cache_set ($obj, $name, $cache)
 views_object_cache_clear ($obj, $name)
 views_object_cache_clean ($age=NULL)

Detailed Description

The non-volatile object cache is used to store an object while it is being edited, so that we don't have to save until we're completely done. The cache should be 'cleaned' on a regular basis, meaning to remove old objects from the cache, but otherwise the data in this cache must remain stable, as it includes unsaved changes.

Function Documentation

views_object_cache_clean ( age = NULL  ) 

Remove all objects in the object cache that are older than the specified age.

Parameters:
$age The minimum age of objects to remove, in seconds. For example, 86400 is one day. Defaults to 7 days.

views_object_cache_clear ( obj,
name 
)

Remove an object from the non-volatile Views cache

Parameters:
$obj A 32 character or less string to define what kind of object is being stored; primarily this is used to prevent collisions.
$name The name of the view (or other object) being stored.

views_object_cache_get ( obj,
name,
skip_cache = FALSE 
)

Get an object from the non-volatile Views cache.

This function caches in memory as well, so that multiple calls to this will not result in multiple database reads.

Parameters:
$obj A 32 character or less string to define what kind of object is being stored; primarily this is used to prevent collisions.
$name The name of the view (or other object) being stored.
$skip_cache Skip the memory cache, meaning this must be read from the db again.
Returns:
The data that was cached.

views_object_cache_set ( obj,
name,
cache 
)

Store an object in the non-volatile Views cache.

Parameters:
$obj A 32 character or less string to define what kind of object is being stored; primarily this is used to prevent collisions.
$name The name of the view (or other object) being stored.
$cache The object to be cached. This will be serialized prior to writing.