Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | class CRM_Utils_Cache_Arraycache implements CRM_Utils_Cache_Interface { | |
3 | ||
4 | /** | |
5 | * The cache storage container, an in memory array by default | |
6 | */ | |
7 | private $_cache; | |
8 | ||
9 | /** | |
10 | * Constructor | |
11 | * | |
12 | * @param array $config an array of configuration params | |
13 | * | |
14 | * @return void | |
15 | */ | |
16 | function __construct($config) { | |
17 | $this->_cache = array(); | |
18 | } | |
19 | ||
20 | function set($key, &$value) { | |
21 | $this->_cache[$key] = $value; | |
22 | } | |
23 | ||
24 | function get($key) { | |
25 | return CRM_Utils_Array::value($key, $this->_cache); | |
26 | } | |
27 | ||
28 | function delete($key) { | |
29 | unset($this->_cache[$key]); | |
30 | } | |
31 | ||
32 | function flush() { | |
33 | unset($this->_cache); | |
34 | $this->_cache = array(); | |
35 | } | |
36 | } | |
37 |