commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / CRM / Utils / Cache / ArrayCache.php
1 <?php
2
3 /**
4 * Class CRM_Utils_Cache_Arraycache
5 */
6 class CRM_Utils_Cache_Arraycache implements CRM_Utils_Cache_Interface {
7
8 /**
9 * The cache storage container, an in memory array by default
10 */
11 private $_cache;
12
13 /**
14 * Constructor.
15 *
16 * @param array $config
17 * An array of configuration params.
18 *
19 * @return \CRM_Utils_Cache_Arraycache
20 */
21 public function __construct($config) {
22 $this->_cache = array();
23 }
24
25 /**
26 * @param string $key
27 * @param mixed $value
28 */
29 public function set($key, &$value) {
30 $this->_cache[$key] = $value;
31 }
32
33 /**
34 * @param string $key
35 *
36 * @return mixed
37 */
38 public function get($key) {
39 return CRM_Utils_Array::value($key, $this->_cache);
40 }
41
42 /**
43 * @param string $key
44 */
45 public function delete($key) {
46 unset($this->_cache[$key]);
47 }
48
49 public function flush() {
50 unset($this->_cache);
51 $this->_cache = array();
52 }
53
54 }