| @@ 155-164 (lines=10) @@ | ||
| 152 | * @override |
|
| 153 | * @inheritDoc |
|
| 154 | */ |
|
| 155 | public function get($key) |
|
| 156 | { |
|
| 157 | if (!$this->isStarted()) |
|
| 158 | { |
|
| 159 | return Promise::doReject(new ReadException('Cache object is not open.')); |
|
| 160 | } |
|
| 161 | return $this->redis->get($key)->then(function($result) { |
|
| 162 | return $result === null ? null : json_decode($result, true); |
|
| 163 | }); |
|
| 164 | } |
|
| 165 | ||
| 166 | /** |
|
| 167 | * @override |
|
| @@ 170-179 (lines=10) @@ | ||
| 167 | * @override |
|
| 168 | * @inheritDoc |
|
| 169 | */ |
|
| 170 | public function remove($key) |
|
| 171 | { |
|
| 172 | if (!$this->isStarted()) |
|
| 173 | { |
|
| 174 | return Promise::doReject(new WriteException('Cache object is not open.')); |
|
| 175 | } |
|
| 176 | return $this->redis->del($key)->then(function($count) { |
|
| 177 | return $count ? true : false; |
|
| 178 | }); |
|
| 179 | } |
|
| 180 | ||
| 181 | /** |
|
| 182 | * @override |
|
| @@ 185-194 (lines=10) @@ | ||
| 182 | * @override |
|
| 183 | * @inheritDoc |
|
| 184 | */ |
|
| 185 | public function exists($key) |
|
| 186 | { |
|
| 187 | if (!$this->isStarted()) |
|
| 188 | { |
|
| 189 | return Promise::doReject(new ReadException('Cache object is not open.')); |
|
| 190 | } |
|
| 191 | return $this->redis->exists($key)->then(function($count) { |
|
| 192 | return $count ? true : false; |
|
| 193 | }); |
|
| 194 | } |
|
| 195 | ||
| 196 | /** |
|
| 197 | * @override |
|