LiveWhale CMS

Welcome, Guest Login

Support Center

Our documentation is moving:

Please check for the most up-to-date LiveWhale CMS and LiveWhale Calendar documentation. The below legacy documentation will remain available as a reference until the documentation migration is complete.

Using LiveWhale Persistent Cache

Last Updated: Nov 26, 2014 02:53PM PST

In some instances, you may want to cache values frequently retrieved by your custom modules, especially if they require intense calculations to produce.

LiveWhale offers access to its own persistent cache with four built-in framework functions:

// Returns a previously set value for the varname key, or FALSE if not set.
// Sets the varname key to $value, overwriting any previous value.
// This method returns TRUE on success or FALSE on failure. 
//$ttl is optional and disabled if not set. This can be used to cache for a specified time (ex., $ttl=3600 //1 hour)
$_LW->setVariable('varname', $value, $ttl=0);

//Returns the mtime of the current variable if it exists (i.e., the last time modified)
// Removes the value set for the 'varname' key.
// This method returns TRUE on success or FALSE on failure.
// Returns TRUE/FALSE if the 'varname' key has been set; useful when the saved value is boolean.


LiveWhale uses APC methods when APC has been installed, or writes the values to disk should it not.
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found