Skip to content

Commit 26e443c

Browse files
committed
Allows RedisClusterProxy instance in Lock RedisStore
1 parent 7ddc6df commit 26e443c

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
@@ -33,13 +33,13 @@ class RedisStore implements StoreInterface
3333
private $initialTtl;
3434

3535
/**
36-
* @param \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface $redisClient
37-
* @param float $initialTtl the expiration delay of locks in seconds
36+
* @param \Redis|\RedisArray|\RedisCluster|RedisProxy|RedisClusterProxy\Predis\ClientInterface $redisClient
37+
* @param float $initialTtl the expiration delay of locks in seconds
3838
*/
3939
public function __construct($redisClient, float $initialTtl = 300.0)
4040
{
41-
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy) {
42-
throw new InvalidArgumentException(sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, "%s" given.', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient)));
41+
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy && !$redisClient instanceof RedisClusterProxy) {
42+
throw new InvalidArgumentException(sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster, RedisProxy, RedisClusterProxy or Predis\ClientInterface, "%s" given.', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient)));
4343
}
4444

4545
if ($initialTtl <= 0) {

Tests/Store/StoreFactoryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public function validConnections()
6161
}
6262
if (class_exists(\Redis::class) && class_exists(AbstractAdapter::class)) {
6363
yield ['redis://localhost', RedisStore::class];
64+
yield ['redis://localhost?lazy=1', RedisStore::class];
65+
yield ['redis://localhost?redis_cluster=1', RedisStore::class];
66+
yield ['redis://localhost?redis_cluster=1&lazy=1', RedisStore::class];
6467
}
6568
if (class_exists(\PDO::class)) {
6669
yield ['sqlite:/tmp/sqlite.db', PdoStore::class];

0 commit comments

Comments
 (0)