class ECKCache in Entity Construction Kit (ECK) 7.2
Same name and namespace in other branches
- 7.3 eck.classes.inc \ECKCache
A class that manages ECK caches.
Hierarchy
- class \ECKCache
Expanded class hierarchy of ECKCache
File
- ./
eck.classes.inc, line 819 - Classes for all the different objects used in ECK.
View source
class ECKCache {
private $id;
private $data;
/**
* Inititate the ECK cache manager.
*
* @param string $id
* What are we caching or retriving? entity_type, bundle, etc.
*/
public function __construct($id) {
$this->id = $id;
}
/**
* Set the cache.
*/
public function set($data) {
cache_set($this->id, $data, "cache_eck");
$this->data = $data;
}
/**
* Get something from the cache.
*/
public function get() {
if ($this->data) {
return $this->data;
}
else {
$cached_data = cache_get($this->id, "cache_eck");
if ($cached_data) {
$this->data = $cached_data->data;
return $this->data;
}
else {
return NULL;
}
}
}
/**
* Reset the cache.
*/
public function reset() {
$this->data = NULL;
cache_clear_all($this->id, 'cache_eck');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ECKCache:: |
private | property | ||
ECKCache:: |
private | property | ||
ECKCache:: |
public | function | Get something from the cache. | |
ECKCache:: |
public | function | Reset the cache. | |
ECKCache:: |
public | function | Set the cache. | |
ECKCache:: |
public | function | Inititate the ECK cache manager. |