File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88use Illuminate \Redis \Connections \PredisConnection ;
99use Illuminate \Support \Facades \Redis ;
1010use Predis \NotSupportedException ;
11+ use Predis \Response \ServerException ;
1112use Throwable ;
1213
1314final class RedisStore
@@ -329,11 +330,24 @@ public function mget(array $keys): array
329330 return $ this ->withRawValues (function (Connection $ connection ) use ($ keys ): array {
330331 if ($ connection instanceof PredisClusterConnection) {
331332 $ groups = $ this ->groupByHashTag ($ keys );
332- $ replies = $ connection ->pipeline (static function ($ pipeline ) use ($ groups ): void {
333- foreach ($ groups as $ group ) {
334- $ pipeline ->mget (...$ group );
333+
334+ try {
335+ $ replies = $ connection ->pipeline (static function ($ pipeline ) use ($ groups ): void {
336+ foreach ($ groups as $ group ) {
337+ $ pipeline ->mget (...$ group );
338+ }
339+ });
340+ } catch (ServerException $ exception ) {
341+ if (!str_starts_with ($ exception ->getMessage (), 'MOVED ' )) {
342+ throw $ exception ;
335343 }
336- });
344+
345+ $ replies = array_map (
346+ static fn (array $ group ): mixed => $ connection ->command ('mget ' , $ group ),
347+ $ groups ,
348+ );
349+ }
350+
337351 $ values = [];
338352
339353 foreach ($ groups as $ groupIndex => $ group ) {
You can’t perform that action at this time.
0 commit comments