Skip to content

Update Config.Client to redis.UniversalClient for Cluster Support (#24) #26

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

namigaliyev
Copy link

This PR updates the Config.Client field in httprateredis.Config from *redis.Client to redis.UniversalClient to enable support for Redis cluster mode via *redis.ClusterClient, addressing issue #24.

Motivation:

  • The current *redis.Client type limits httprateredis to single Redis instances, causing type mismatch errors when using *redis.ClusterClient
  • redis.UniversalClient is a flexible interface supporting both *redis.Client (single instance), *redis.ClusterClient (cluster mode), and *redis.Ring (sharded Redis), making it suitable for broader use cases.

Changes:

  • Changed Config.Client in config.go from *redis.Client to redis.UniversalClient.
  • No modifications to rate-limiting logic, as all Redis commands (e.g., INCR, EXPIRE, GET) are supported by redis.UniversalClient.

Impact:

  • Enables httprateredis to work seamlessly with Redis cluster mode, addressing community demand in Allow other go-redis client implementations #24.
  • Maintains full compatibility with existing *redis.Client usage for single-instance Redis.
  • Enhances flexibility for other redis.UniversalClient implementations.

@namigaliyev
Copy link
Author

namigaliyev commented Apr 16, 2025

@VojtechVitek @pkieltyka hello, please help to review this, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants