Zend Data (disk) Cache adapter.
Constructor.
| Type | Description |
|---|---|
| array | Configuration |
NULL
public function __construct(array $config)
{
parent::__construct($config['identifier']);
if(function_exists('zend_disk_cache_fetch') === false)
{
throw new RuntimeException(vsprintf("%s(): Zend Data Cache is not available.", array(__METHOD__)));
}
}
Store variable in the cache.
| Type | Description |
|---|---|
| string | Cache key |
| mixed | The variable to store |
| int | (optional) Time to live |
boolean
public function write($key, $value, $ttl = 0)
{
return zend_disk_cache_store("{$this->identifier}_{$key}", $value, $ttl);
}
Fetch variable from the cache.
| Type | Description |
|---|---|
| string | Cache key |
mixed
public function read($key)
{
return zend_disk_cache_fetch("{$this->identifier}_{$key}");
}
Delete a variable from the cache.
| Type | Description |
|---|---|
| string | Cache key |
boolean
public function delete($key)
{
return zend_disk_cache_delete("{$this->identifier}_{$key}");
}
Clears the user cache.
boolean
public function clear()
{
return zend_disk_cache_clear();
}
Fetches variable from cache and stores it if it doesn't exist.
| Type | Description |
|---|---|
| string | Cache key |
| closure | Closure (anonymous function) that returns value to store if it doesn't already exist |
| int | (optional) Time to live |
mixed
Magic setter.
| Type | Description |
|---|---|
| string | Cache key |
| mixed | The variable to store |
NULL
Magic getter.
| Type | Description |
|---|---|
| string | Cache key |
mixed
Magic isset.
| Type | Description |
|---|---|
| string | Cache key |
boolean
Magic unsetter.
| Type | Description |
|---|---|
| string | Cache key |
NULL