Last active
June 18, 2021 09:49
-
-
Save nelson-ph/833d7536227b8fd9e31a2fbd649073d9 to your computer and use it in GitHub Desktop.
Drupal 8 - Redis cluster - add prediscluster doDeleteMultiple support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: src/Cache/PredisCluster.php | |
| IDEA additional info: | |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
| <+>UTF-8 | |
| =================================================================== | |
| diff --git a/src/Cache/PredisCluster.php b/src/Cache/PredisCluster.php | |
| --- a/src/Cache/PredisCluster.php (date 1623849227261) | |
| +++ b/src/Cache/PredisCluster.php (date 1623849227261) | |
| @@ -27,4 +27,18 @@ | |
| parent::__construct($bin, $client, $checksum_provider, $serializer); | |
| } | |
| -} | |
| \ No newline at end of file | |
| + /** | |
| + * {@inheritdoc} | |
| + */ | |
| + public function doDeleteMultiple(array $cids) { | |
| + if (!empty($cids)) { | |
| + $keys = array_map([$this, 'getKey'], $cids); | |
| + $pipe = $this->client->pipeline(); | |
| + foreach ($keys as $key){ | |
| + $pipe->del($key); | |
| + } | |
| + $pipe->execute(); | |
| + } | |
| + } | |
| + | |
| +} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment