-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Mark RedisProxy
as non-@internal
?
#47267
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
Comments
See also #42428 |
With #47236 we should be able to make Redis lazy without RedisProxy. Worth a try after merging. Then we might consider deprecating RedisProxy instead. |
Looks good but not sure it would fit my scenario, I'm using symfony/cache as a standalone lib, not with DI. |
Seems that Thanks everyone for the hints and comments! |
This PR was merged into the 6.2 branch. Discussion ---------- [Cache] make `Redis*Proxy` extend `Redis*` | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix #47267, #42428 | License | MIT | Doc PR | - `Redis*Proxy` did not extend native classes because we missed the code infrastructure to generate appropriate proxies. With #47236, we now have it. This PR adds generated proxies to the cache component to keep it lazy-able out of the box. Commits ------- cfb46ed [Cache] make `Redis*Proxy` extend `Redis*`
Description
Hi,
I'm using
RedisAdapter
in an app that already uses Redis (the server) heavily and I'd like to reuse the same connection in the adapter. The connection has several non-default options set and I could open it and pass the\Redis
object to the adapter but that would mean the connection is non-lazy. I'd like it to be lazy, to be opened when needed.There's an option for lazy connections when using a DSN which creates a
RedisProxy
object and passes it instead of theRedis
object but that means another connection in my case. The lazy option is here https://github.com/symfony/cache/blob/5cf8e75f02932818889e0609380b8d5427a6c86c/Traits/RedisTrait.php#L247-L251The proxy class is very useful for my case, I can set it up and pass a
Redis
instance and create an initializer closure that would call my connect method which sets options I need, when needed.I've noticed the
RedisProxy
class is marked as@internal
. I'm a bit nervous when using internal classes so I was wondering whether it would be possible to drop the tag and if I can send a PR and what else it should contain. Or what would be the best way forward to reuse connections in a lazy way.Thanks!
Example
The text was updated successfully, but these errors were encountered: