Skip to content

[Cache] Mark RedisProxy as non-@internal? #47267

Closed
@spaze

Description

@spaze

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 the Redis 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-L251

The 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

 vendor/symfony/cache/Traits/RedisProxy.php | 1 -
 1 file changed, 1 deletion(-)

diff --git c/vendor/symfony/cache/Traits/RedisProxy.php w/vendor/symfony/cache/Traits/RedisProxy.php
index ec5cfabb3..5df60c179 100644
--- c/vendor/symfony/cache/Traits/RedisProxy.php
+++ w/vendor/symfony/cache/Traits/RedisProxy.php
@@ -14,7 +14,6 @@ namespace Symfony\Component\Cache\Traits;
 /**
  * @author Nicolas Grekas <p@tchwork.com>
  *
- * @internal
  */
 class RedisProxy
 {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions