-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache][Lock] Add RedisProxy for lazy Redis connections #24887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
(now investigating the failure) |
778abd8
to
feca03f
Compare
PR ready. |
Same issue affects the Lock component, and could be patched in the same way. I will open a PR when this one will be merged to reuse the RedisProxy. (thanks FWBundle has a dependency on Cache) Diff is to take into account and allow the new class |
feca03f
to
1f5e353
Compare
@@ -49,7 +50,7 @@ public function init($redisClient, $namespace = '', $defaultLifetime = 0) | |||
} | |||
if ($redisClient instanceof \RedisCluster) { | |||
$this->enableVersioning(); | |||
} elseif (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \Predis\Client) { | |||
} elseif (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \Predis\Client && !$redisClient instanceof RedisProxy) { | |||
throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, is_object($redisClient) ? get_class($redisClient) : gettype($redisClient))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this message needs an update right? Same for below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer not: RedisProxy is internal (same for docblocks)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right! 👍
Thank you @nicolas-grekas. |
…s (nicolas-grekas) This PR was merged into the 3.4 branch. Discussion ---------- [Cache][Lock] Add RedisProxy for lazy Redis connections | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #24865 | License | MIT | Doc PR | - That's the only provider that is not lazy by default, leading to bad DX (see linked issue.) Best reviewed [ignoring whitespaces](https://github.com/symfony/symfony/pull/24887/files?w=1). Commits ------- 1f5e353 [Cache][Lock] Add RedisProxy for lazy Redis connections
Hey, looks like it breaks Memcached adapter.
|
@ahilles107 correct, see #25038. I invite you to create issues when encountering an issue, as comments on closed PRs/issues are kinda lost most of the time. And looking at the history before doing so ;) |
That's the only provider that is not lazy by default, leading to bad DX (see linked issue.)
Best reviewed ignoring whitespaces.