1 | <?php |
||
6 | class FlintRedisCacheRedis implements FlintRedisCache |
||
7 | { |
||
8 | |||
9 | private $realm; |
||
10 | |||
11 | private $predis; |
||
12 | |||
13 | 6 | public function __construct($realm = 'default', $options = []) |
|
18 | |||
19 | public function get($key) |
||
23 | |||
24 | public function getAll() |
||
25 | { |
||
26 | $values = []; |
||
27 | |||
28 | foreach ($this->predis->hgetall($this->realm) as $k => $v) { |
||
29 | $values[$k] = unserialize($v); |
||
30 | } |
||
31 | |||
32 | return $values; |
||
33 | } |
||
34 | |||
35 | public function getKeys() |
||
36 | { |
||
37 | return $this->predis->hkeys($this->realm); |
||
38 | } |
||
39 | |||
40 | public function set($key, $value) |
||
41 | { |
||
42 | return $this->predis->hset($this->realm, $key, serialize($value)); |
||
43 | } |
||
44 | |||
45 | public function delete($key) |
||
49 | |||
50 | public function flush() |
||
54 | } |
||
55 |