Skip to content

Commit c7e3f05

Browse files
Merge branch '5.0' into 5.1
* 5.0: Allows RedisClusterProxy instance in Lock RedisStore
2 parents e5bb4a2 + 4e4cc2c commit c7e3f05

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Store/RedisStore.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ class RedisStore implements PersistingStoreInterface
3232
private $initialTtl;
3333

3434
/**
35-
* @param \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface $redisClient
36-
* @param float $initialTtl the expiration delay of locks in seconds
35+
* @param \Redis|\RedisArray|\RedisCluster|RedisProxy|RedisClusterProxy\Predis\ClientInterface $redisClient
36+
* @param float $initialTtl the expiration delay of locks in seconds
3737
*/
3838
public function __construct($redisClient, float $initialTtl = 300.0)
3939
{
40-
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy) {
41-
throw new InvalidArgumentException(sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, "%s" given.', __METHOD__, get_debug_type($redisClient)));
40+
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy && !$redisClient instanceof RedisClusterProxy) {
41+
throw new InvalidArgumentException(sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster, RedisProxy, RedisClusterProxy or Predis\ClientInterface, "%s" given.', __METHOD__, get_debug_type($redisClient)));
4242
}
4343

4444
if ($initialTtl <= 0) {

Tests/Store/StoreFactoryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ public function validConnections()
6666
}
6767
if (class_exists(\Redis::class) && class_exists(AbstractAdapter::class)) {
6868
yield ['redis://localhost', RedisStore::class];
69+
yield ['redis://localhost?lazy=1', RedisStore::class];
70+
yield ['redis://localhost?redis_cluster=1', RedisStore::class];
71+
yield ['redis://localhost?redis_cluster=1&lazy=1', RedisStore::class];
6972
}
7073
if (class_exists(\PDO::class)) {
7174
yield ['sqlite:/tmp/sqlite.db', PdoStore::class];

0 commit comments

Comments
 (0)