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