
Public Member Functions | |
| set ($key, $value, $timeout=null) | |
| get ($key, $default=null) | |
Static Public Member Functions | |
| static | factory () |
You should not use this class directly, but one of the subclasses implementing a given engine. This is done automatically when using the factory. It will use the engine defined by the 'cache_engine' configuration variable.
Default timeout in seconds is defined by the 'cache_timeout' configuration variable.
$cache = new Pluf_Cache::factory(); if (null === ($foo=$cache->get('my-key'))) { $foo = run_complex_operation(); $cache->set('my-key', $foo); } return $foo;
The value to be stored in the cache must be serializable.
| static Pluf_Cache::factory | ( | ) | [static] |
Factory.
| Pluf_Cache::set | ( | $ | key, | |
| $ | value, | |||
| $ | timeout = null | |||
| ) |
Set a value in the cache.
| string | Key to store the information | |
| mixed | Value to store | |
| int | Timeout in seconds (null) |
Reimplemented in Pluf_Cache_Apc, Pluf_Cache_File, and Pluf_Cache_Memcached.
| Pluf_Cache::get | ( | $ | key, | |
| $ | default = null | |||
| ) |
Get value from the cache.
| string | Key to get the information | |
| mixed | Default value to return if cache miss (null) | |
| mixed | Stored value or default |
Reimplemented in Pluf_Cache_Apc, Pluf_Cache_File, and Pluf_Cache_Memcached.