-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Use universal interface for Redis, or remove @internal from RedisProxy
#42428
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
i also concluded im 👍 given |
@nicolas-grekas #42087 (comment)
You wrong. At this moment Symfony\Component\Lock\Store\RedisStore
Symfony\Component\Cache\Adapter\RedisAdapter
Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler because all of them has strict instanceof checks like if (
!$redis instanceof \Redis &&
!$redis instanceof \RedisArray &&
!$redis instanceof \RedisCluster &&
!$redis instanceof \Predis\ClientInterface &&
!$redis instanceof RedisProxy &&
!$redis instanceof RedisClusterProxy
) {
throw new \InvalidArgumentException(sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, "%s" given.', __METHOD__, get_debug_type($redis)));
} |
@nicolas-grekas pls reconsider :) im depending on it for a |
I'm sorry but as I explained in #42087 I don't have a solution better than telling you to extend |
Now im wondering, if good old |
Could be! :) |
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
At this moment all of Symfony Redis adapters/handlers tightly bound to
\Redis | \RedisArray | \RedisCluster | RedisProxy | RedisClusterProxy | \Predis\ClientInterface
I want to log/profile redis commands (phpredis), but there is no right way to use decorated Redis class with Symfony components.
Attempt 2 - extend
\Redis
This requires to override all Redis methods and this is ridiculous. Look at this 1500+ lines example:
https://github.com/snc/SncRedisBundle/blob/d7718cd75166bb256380cf428cbde54402be149e/Client/Phpredis/Client.php#L189
Attempt 3 (dirty) - extend
Symfony\Component\Cache\Traits\RedisProxy
.This works, but
RedisProxy
marked as@internal
so you will get deprecation errors. And since it's internal - there is no guarantee that this class will not be silently changed.Attempt 4 (dirty+monkeypatching) - copy
RedisProxy
tosrc
. Configureautoload
andexclude-from-classmap
in composer.json. But let's leave monkeypatching for javascript community!Final thoughts
Please either remove
@internal
fromSymfony\Component\Cache\Traits\RedisProxy
or add another way to solve this problemThe text was updated successfully, but these errors were encountered: