Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0eae7a6

Browse filesBrowse files
bug #37590 Allows RedisClusterProxy instance in Lock RedisStore (jderusse)
This PR was merged into the 4.4 branch. Discussion ---------- Allows RedisClusterProxy instance in Lock RedisStore | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #37476 | License | MIT | Doc PR | / This PR allow clients instance of RedisClusterProxy created by the StoreFactory in #28691 /cc @nicolas-grekas Commits ------- 8ef63cd Allows RedisClusterProxy instance in Lock RedisStore
2 parents 2c84ea2 + 8ef63cd commit 0eae7a6
Copy full SHA for 0eae7a6

File tree

3 files changed

+8
-5
lines changed
Filter options

3 files changed

+8
-5
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/RedisTrait.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Store/RedisStore.php
+4-4Lines 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) {

‎src/Symfony/Component/Lock/Tests/Store/StoreFactoryTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Tests/Store/StoreFactoryTest.php
+3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.