1 | <?php |
||
18 | class RedisCache implements Cache |
||
19 | { |
||
20 | use MultiCacheTrait { |
||
21 | MultiCacheTrait::setItems as setItemsTrait; |
||
22 | } |
||
23 | |||
24 | const DEFAULT_HOST = '127.0.0.1'; |
||
25 | const DEFAULT_PORT = 6379; |
||
26 | const DEFAULT_DB = 0; |
||
27 | const DEFAULT_TIMEOUT = 0.0; |
||
28 | |||
29 | /** |
||
30 | * @var Redis |
||
31 | */ |
||
32 | private $client; |
||
33 | |||
34 | /** |
||
35 | * RedisCache constructor. |
||
36 | * |
||
37 | * @param Redis $client |
||
38 | */ |
||
39 | 1 | public function __construct(Redis $client) |
|
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 1 | public function set($key, $value, $timeToLive = null) |
|
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | 1 | public function setItems(array $items, $timeToLive = null) |
|
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | 1 | public function has($key) |
|
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | 1 | public function demand($key) |
|
89 | |||
90 | /** |
||
91 | * {@inheritdoc} |
||
92 | */ |
||
93 | 1 | public function get($key, $default = null) |
|
101 | |||
102 | /** |
||
103 | * {@inheritdoc} |
||
104 | */ |
||
105 | public function getItems(array $keys) |
||
111 | |||
112 | /** |
||
113 | * {@inheritdoc} |
||
114 | */ |
||
115 | 1 | public function delete($key) |
|
119 | |||
120 | /** |
||
121 | * {@inheritdoc} |
||
122 | */ |
||
123 | public function deleteAll(array $keys) |
||
127 | |||
128 | /** |
||
129 | * {@inheritdoc} |
||
130 | */ |
||
131 | 1 | public function flush() |
|
135 | |||
136 | /** |
||
137 | * {@inheritdoc} |
||
138 | */ |
||
139 | 1 | public function getTimeToLive($key) |
|
145 | } |
||
146 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: