| @@ 249-261 (lines=13) @@ | ||
| 246 | /** |
|
| 247 | * {@inheritdoc} |
|
| 248 | */ |
|
| 249 | public function remove($key) |
|
| 250 | { |
|
| 251 | KeyUtil::validate($key); |
|
| 252 | ||
| 253 | try { |
|
| 254 | $result = $this->collection->deleteOne(array('_id' => $key)); |
|
| 255 | $deletedCount = $result->getDeletedCount(); |
|
| 256 | } catch (Exception $e) { |
|
| 257 | throw WriteException::forException($e); |
|
| 258 | } |
|
| 259 | ||
| 260 | return $deletedCount > 0; |
|
| 261 | } |
|
| 262 | ||
| 263 | /** |
|
| 264 | * {@inheritdoc} |
|
| @@ 266-278 (lines=13) @@ | ||
| 263 | /** |
|
| 264 | * {@inheritdoc} |
|
| 265 | */ |
|
| 266 | public function exists($key) |
|
| 267 | { |
|
| 268 | KeyUtil::validate($key); |
|
| 269 | ||
| 270 | try { |
|
| 271 | $count = $this->collection->count(array('_id' => $key)); |
|
| 272 | } catch (Exception $e) { |
|
| 273 | throw ReadException::forException($e); |
|
| 274 | } |
|
| 275 | ||
| 276 | return $count > 0; |
|
| 277 | ||
| 278 | } |
|
| 279 | ||
| 280 | /** |
|
| 281 | * {@inheritdoc} |
|