Skip to content

Commit 6411faa

Browse files
committed
Fix Redis import
1 parent 079ca1f commit 6411faa

File tree

6 files changed

+25
-1
lines changed

6 files changed

+25
-1
lines changed

src/Dashboards/Redis/Compatibility/Cluster/PredisCluster.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,4 +455,8 @@ public function getCommands(): array {
455455

456456
return array_column($commands, 0);
457457
}
458+
459+
public function restoreKeys(string $key, int $ttl, string $value): bool {
460+
return (string) $this->restore($key, $ttl, $value) === 'OK';
461+
}
458462
}

src/Dashboards/Redis/Compatibility/Cluster/RedisCluster.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,4 +358,11 @@ public function getCommands(): array {
358358

359359
return array_column($commands, 0);
360360
}
361+
362+
/**
363+
* @throws RedisClusterException
364+
*/
365+
public function restoreKeys(string $key, int $ttl, string $value): bool {
366+
return $this->restore($key, $ttl, $value);
367+
}
361368
}

src/Dashboards/Redis/Compatibility/Predis.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,8 @@ public function getCommands(): array {
222222

223223
return array_column($commands, 0);
224224
}
225+
226+
public function restoreKeys(string $key, int $ttl, string $value): bool {
227+
return (string) $this->restore($key, $ttl, $value) === 'OK';
228+
}
225229
}

src/Dashboards/Redis/Compatibility/Redis.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,8 @@ public function getCommands(): array {
239239

240240
return array_column($commands, 0);
241241
}
242+
243+
public function restoreKeys(string $key, int $ttl, string $value): bool {
244+
return $this->restore($key, $ttl, $value);
245+
}
242246
}

src/Dashboards/Redis/Compatibility/RedisCompatibilityInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,9 @@ public function resetSlowlog(): bool;
9898
* @return array<int, string>
9999
*/
100100
public function getCommands(): array;
101+
102+
/**
103+
* Alias to a restore().
104+
*/
105+
public function restoreKeys(string $key, int $ttl, string $value): bool;
101106
}

src/Dashboards/Redis/RedisTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ function (string $key): bool {
622622
return is_int($exists) && $exists > 0;
623623
},
624624
function (string $key, string $value, int $ttl): bool {
625-
return $this->redis->restore($key, ($ttl === -1 ? 0 : $ttl), hex2bin($value));
625+
return $this->redis->restoreKeys($key, ($ttl === -1 ? 0 : $ttl), hex2bin($value));
626626
}
627627
);
628628
}

0 commit comments

Comments
 (0)