Skip to content

Commit 0ab5eed

Browse files
Merge branch '5.1'
* 5.1: Allows RedisClusterProxy instance in Lock RedisStore
2 parents 36933f2 + ef1566e commit 0ab5eed

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private function init($redisClient, string $namespace, int $defaultLifetime, ?Ma
8484
*
8585
* @throws InvalidArgumentException when the DSN is invalid
8686
*
87-
* @return \Redis|\RedisCluster|\Predis\ClientInterface According to the "class" option
87+
* @return \Redis|\RedisCluster|RedisClusterProxy|RedisProxy|\Predis\ClientInterface According to the "class" option
8888
*/
8989
public static function createConnection($dsn, array $options = [])
9090
{

src/Symfony/Component/Lock/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) {

src/Symfony/Component/Lock/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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy