1 <?php
2 /**
3 * Neevo - Tiny database layer for PHP. (http://neevo.smasty.net)
4 *
5 * This source file is subject to the MIT license that is bundled
6 * with this package in the file license.txt.
7 *
8 * Copyright (c) 2012 Smasty (http://smasty.net)
9 *
10 */
11
12 namespace Neevo\Cache;
13
14
15 /**
16 * Memory cache storage.
17 * Default implementation of Neevo\ICache.
18 * @author Smasty
19 */
20 class MemoryStorage implements StorageInterface {
21
22
23 /** @var array */
24 private $data = array();
25
26
27 public function fetch($key){
28 return array_key_exists($key, $this->data) ? $this->data[$key] : null;
29 }
30
31
32 public function store($key, $value){
33 $this->data[$key] = $value;
34 }
35
36
37 public function flush(){
38 return!$this->data = array();
39 }
40
41
42 }
43
44