-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Feature Request: Support ZRANGE arguments (BYSCORE, BYLEX, REV, LIMIT) #3681
Description
Feature Request
Is your feature request related to a problem? Please describe
Redis 6.2.0 deprecated several Sorted Set commands (ZRANGEBYSCORE, ZRANGEBYLEX, ZREVRANGE, etc.) in favor of an enhanced ZRANGE command. Currently, Lettuce lacks the ZRANGE overloads to support the new BYSCORE, BYLEX, REV, and LIMIT flags, leaving users without a modern migration path for the deprecated APIs discussed in #3615.
Describe the solution you'd like
Enhance Lettuce to support the unified ZRANGE syntax by:
- Updating
ZRangeArgs: Add methods.byScore(),.byLex(), and.rev(). - Adding Overloads: Implement
zrangemethods inRedisSortedSetCommandsthat acceptZRangeArgs. - Protocol Mapping: Ensure the command is encoded as
ZRANGE <key> <min> <max> [BYSCORE|BYLEX] [REV] [LIMIT offset count].
Drawbacks: Minimal. This is an additive change to maintain parity with Redis 6.2+.
Describe alternatives you've considered
Using dispatch to send custom commands, but this bypasses Lettuce's type-safety and fluent API benefits.
Teachability, Documentation, Adoption, Migration Strategy
Users can migrate from deprecated commands to the new unified zrange easily:
Old (Deprecated):
// ZRANGEBYSCORE key 0 100
redis.zrangebyscore("mykey", Range.from(Boundary.including(0), Boundary.including(100)));New (Unified):
// ZRANGE key 0 100 BYSCORE
redis.zrange("mykey", Range.from(Boundary.including(0), Boundary.including(100)), ZRangeArgs.builder().byScore());Note: For REV operations, users should be aware that ZRANGE ... REV maintains a consistent min max order, unlike the old ZREV... commands which required inverted max min parameters.