1<?php
2/**
3 * A dummy array cache
4 *
5 * @category  Xamin
6 * @package   Handlebars
7 * @author    fzerorubigd <fzerorubigd@gmail.com>
8 * @author    Behrooz Shabani <everplays@gmail.com>
9 * @copyright 2012 (c) ParsPooyesh Co
10 * @copyright 2013 (c) Behrooz Shabani
11 * @license   MIT
12 * @link      http://voodoophp.org/docs/handlebars
13 */
14
15namespace Handlebars\Cache;
16use Handlebars\Cache;
17
18class Dummy implements Cache
19{
20    private $cache = [];
21
22    /**
23     * Get cache for $name if exist.
24     *
25     * @param string $name Cache id
26     *
27     * @return mixed data on hit, boolean false on cache not found
28     */
29    public function get($name)
30    {
31        if (array_key_exists($name, $this->cache)) {
32            return $this->cache[$name];
33        }
34        return false;
35    }
36
37    /**
38     * Set a cache
39     *
40     * @param string $name  cache id
41     * @param mixed  $value data to store
42     *
43     * @return void
44     */
45    public function set($name, $value)
46    {
47        $this->cache[$name] = $value;
48    }
49
50    /**
51     * Remove cache
52     *
53     * @param string $name Cache id
54     *
55     * @return void
56     */
57    public function remove($name)
58    {
59        unset($this->cache[$name]);
60    }
61
62}