1 | <?php |
||
15 | class Memcached extends Storage |
||
16 | { |
||
17 | /** |
||
18 | * The Memcache instance. |
||
19 | * |
||
20 | * @var \Memcached |
||
21 | */ |
||
22 | public $memcache; |
||
23 | |||
24 | /** |
||
25 | * The cache key from the cache configuration file. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $key; |
||
30 | |||
31 | /** |
||
32 | * @param \Memcached $memcache |
||
33 | * @param $key |
||
34 | */ |
||
35 | public function __construct(\Memcached $memcache, $key) |
||
40 | |||
41 | /** |
||
42 | * @param string $key |
||
43 | * |
||
44 | * @return mixed |
||
45 | */ |
||
46 | protected function retrieve($key) |
||
54 | |||
55 | /** |
||
56 | * Write an item to the cache for a given number of minutes. |
||
57 | * |
||
58 | * <code> |
||
59 | * // Put an item in the cache for 15 minutes |
||
60 | * Cache::put('name', 'Robin', 15); |
||
61 | * </code> |
||
62 | * |
||
63 | * @param string $key |
||
64 | * @param mixed $value |
||
65 | * @param int $minutes |
||
66 | * |
||
67 | * @return bool|void |
||
68 | */ |
||
69 | public function put($key, $value, $minutes) |
||
73 | |||
74 | /** |
||
75 | * Write an item to the cache that lasts forever. |
||
76 | * |
||
77 | * @param $key |
||
78 | * @param $value |
||
79 | * |
||
80 | * @return bool|void |
||
81 | */ |
||
82 | public function forever($key, $value) |
||
86 | |||
87 | /** |
||
88 | * Delete an item from the cache. |
||
89 | * |
||
90 | * @param string $key |
||
91 | * |
||
92 | * @return bool|void |
||
93 | */ |
||
94 | public function forget($key) |
||
98 | } |
||
99 |