Commit 854660d
Pass zrevrange key as a list in options["keys"] to match sibling range commands (#4244)
* Pass zrevrange key as a list to match sibling range commands
ZREVRANGE stored its key in options["keys"] as a bare string, while every
sibling range command (zrange, zrangebyscore, zrevrangebyscore) passes it as
a list: options["keys"] = [name].
Consumers of options["keys"] iterate it as a sequence of keys. For a bare
string that walks the key character by character -- for example client-side
cache key construction builds CacheKey(redis_keys=tuple(keys)), turning key
"myzset" into ('m', 'y', 'z', 's', 'e', 't') instead of ('myzset',).
Wrap the key in a list to match the other range commands, and add a
regression test asserting zrevrange passes keys=[name].
* Move zrevrange regression test to the cache level
Address review: replace the test that asserted the internal `keys` kwarg with
a behavior-level regression test in tests/test_cache.py. It caches a
`zrevrange` result, asserts the entry is stored under the whole-key cache key
(`redis_keys=("myzset",)`) rather than per-character, and that mutating the
sorted set from a second client invalidates it. This fails on master and
passes with the fix, and protects the behavior rather than the plumbing.
---------
Co-authored-by: uttam12331 <uttam12331@users.noreply.github.com>
Co-authored-by: petyaslavova <petya.slavova@redis.com>1 parent 1627c98 commit 854660d
2 files changed
Lines changed: 42 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8988 | 8988 | | |
8989 | 8989 | | |
8990 | 8990 | | |
8991 | | - | |
| 8991 | + | |
8992 | 8992 | | |
8993 | 8993 | | |
8994 | 8994 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
102 | 143 | | |
103 | 144 | | |
104 | 145 | | |
| |||
0 commit comments