- Openclerk\Cache
class Openclerk \ Cache
Naive caching of strings. Get the most recent cache value or recompile it using a callback. Uses key/hash storage.
Method Summary
Name | Description |
---|---|
get(Connection $db, $key, $hash, $age, $callback, $args = array()) | Get the most recent database cache value for the given $key and $hash, or recompile it from the $callback and $arguments if the database cache value is more than $age seconds old. |
static function get(Connection $db, $key, $hash, $age, $callback, $args = array())
Get the most recent database cache value for the given $key and $hash, or recompile it from the $callback and $arguments if the database cache value is more than $age seconds old.
- Parameters:
$db
- the database connection to use$key
- the cache key, must be < 255 chars string$hash
- must be < 32 chars string$age
- the maximum age for the cache in seconds$callback
- the function which will generate the content if the cache is invalidated or missing, must return less than 16 MB of content$args
- the arguments to pass to the callback, if any- Defaults:
args
= array()