Skip to content

Commit 606df24

Browse files
bug symfony#61234 [Cache] RedisTrait::doFetch should use pipeline with GET's instead of MGET for Relay\Cluster (dorrogeray)
This PR was submitted for the 7.3 branch but it was merged into the 6.4 branch instead. Discussion ---------- [Cache] RedisTrait::doFetch should use pipeline with GET's instead of MGET for Relay\Cluster | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #... | License | MIT 🛠️ `Relay\Cluster` should be expected to operate with >1 master nodes, and therefore its not safe to use `mget` when fetching the ids in `RedisTrait::doFetch(array $ids)` as they are not guaranteed to be on a same hash slot. This change makes `doFetch` use pipeline with `GET` commands when `$this->redis instanceof RelayCluster` Commits ------- 30a2ca0 [cache] RedisTrait::doFetch should use pipeline instead of mget for Relay\Cluster
2 parents d157aa7 + 30a2ca0 commit 606df24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ protected function doFetch(array $ids): iterable
434434

435435
$result = [];
436436

437-
if ($this->redis instanceof \Predis\ClientInterface && ($this->redis->getConnection() instanceof ClusterInterface || $this->redis->getConnection() instanceof Predis2ClusterInterface)) {
437+
if (($this->redis instanceof \Predis\ClientInterface && ($this->redis->getConnection() instanceof ClusterInterface || $this->redis->getConnection() instanceof Predis2ClusterInterface)) || $this->redis instanceof RelayCluster) {
438438
$values = $this->pipeline(function () use ($ids) {
439439
foreach ($ids as $id) {
440440
yield 'get' => [$id];

0 commit comments

Comments
 (0)