1 | <?php |
||
20 | class Redis extends Cache |
||
21 | { |
||
22 | /** |
||
23 | * The redis driver. |
||
24 | * |
||
25 | * @var \Redis |
||
26 | * @since 1.0 |
||
27 | */ |
||
28 | private $driver; |
||
29 | |||
30 | /** |
||
31 | * Constructor. |
||
32 | * |
||
33 | * @param \Redis $redis The Redis driver being used for this pool |
||
34 | * @param array|\ArrayAccess $options An options array, or an object that implements \ArrayAccess |
||
35 | * |
||
36 | * @since __DEPLOY_VERSION__ |
||
37 | * @throws \RuntimeException |
||
38 | */ |
||
39 | 10 | public function __construct(\Redis $redis, $options = []) |
|
46 | |||
47 | /** |
||
48 | * This will wipe out the entire cache's keys |
||
49 | * |
||
50 | * @return boolean The result of the clear operation. |
||
51 | * |
||
52 | * @since 1.0 |
||
53 | */ |
||
54 | 10 | public function clear() |
|
58 | |||
59 | /** |
||
60 | * Method to get a storage entry value from a key. |
||
61 | * |
||
62 | * @param string $key The storage entry identifier. |
||
63 | * |
||
64 | * @return CacheItemInterface |
||
65 | * |
||
66 | * @since 1.0 |
||
67 | */ |
||
68 | 5 | public function getItem($key) |
|
80 | |||
81 | /** |
||
82 | * Method to remove a storage entry for a key. |
||
83 | * |
||
84 | * @param string $key The storage entry identifier. |
||
85 | * |
||
86 | * @return boolean |
||
87 | * |
||
88 | * @since 1.0 |
||
89 | */ |
||
90 | 2 | public function deleteItem($key) |
|
100 | |||
101 | /** |
||
102 | * Persists a cache item immediately. |
||
103 | * |
||
104 | * @param CacheItemInterface $item The cache item to save. |
||
105 | * |
||
106 | * @return bool True if the item was successfully persisted. False if there was an error. |
||
107 | */ |
||
108 | 8 | public function save(CacheItemInterface $item) |
|
122 | |||
123 | /** |
||
124 | * Method to determine whether a storage entry has been set for a key. |
||
125 | * |
||
126 | * @param string $key The storage entry identifier. |
||
127 | * |
||
128 | * @return boolean |
||
129 | * |
||
130 | * @since 1.0 |
||
131 | */ |
||
132 | 4 | public function hasItem($key) |
|
136 | |||
137 | /** |
||
138 | * Test to see if the CacheItemPoolInterface is available |
||
139 | * |
||
140 | * @return boolean True on success, false otherwise |
||
141 | * |
||
142 | * @since __DEPLOY_VERSION__ |
||
143 | */ |
||
144 | 10 | public static function isSupported() |
|
148 | } |
||
149 |