4
* This file is part of the Assetic package, an OpenSky project.
6
* (c) 2010-2013 OpenSky Project Inc
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
12
namespace Assetic\Cache;
15
* A simple array cache
17
* @author Michael Mifsud <xzyfer@gmail.com>
19
class ArrayCache implements CacheInterface
21
private $cache = array();
24
* @see CacheInterface::has()
26
public function has($key)
28
return isset($this->cache[$key]);
32
* @see CacheInterface::get()
34
public function get($key)
36
if(!$this->has($key)) {
37
throw new \RuntimeException('There is no cached value for '.$key);
40
return $this->cache[$key];
44
* @see CacheInterface::set()
46
public function set($key, $value)
48
$this->cache[$key] = $value;
52
* @see CacheInterface::remove()
54
public function remove($key)
56
unset($this->cache[$key]);