Skip to content

Commit 852e8d1

Browse files
middleware/prefix: Add prefix formating for sorted set commands
1 parent e24f7fb commit 852e8d1

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

middleware/prefix/executor.go

+24-1
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,35 @@ var (
3535
"SETRANGE": staticIndexRewriter(0),
3636
"STRLEN": staticIndexRewriter(0),
3737
"SUBSTR": staticIndexRewriter(0),
38+
"DEL": indexedRewriteExecutors(func(idx int, _ interface{}) bool { return true }),
3839
}
3940

4041
genericExecutors = map[string]Executor{}
4142
listExecutors = map[string]Executor{}
4243
hashExecutors = map[string]Executor{}
43-
sortedSetExecutors = map[string]Executor{}
44+
sortedSetExecutors = map[string]Executor{
45+
"ZADD": staticIndexRewriter(0),
46+
"ZCOUNT": staticIndexRewriter(0),
47+
"ZRANGE": staticIndexRewriter(0),
48+
"ZREM": staticIndexRewriter(0),
49+
"ZCARD": staticIndexRewriter(0),
50+
"ZSCORE": staticIndexRewriter(0),
51+
"ZSCAN": staticIndexRewriter(0),
52+
"ZRANK": staticIndexRewriter(0),
53+
"ZREVRANK": staticIndexRewriter(0),
54+
"ZREMRANGEBYSCORE": staticIndexRewriter(0),
55+
"ZREMRANGEBYRANK": staticIndexRewriter(0),
56+
"ZREMRANGEBYLEX": staticIndexRewriter(0),
57+
"ZRANDMEMBER": staticIndexRewriter(0),
58+
"ZPOPMIN": staticIndexRewriter(0),
59+
"ZPOPMAX": staticIndexRewriter(0),
60+
"ZINCRBY": staticIndexRewriter(0),
61+
"ZLEXCOUNT": staticIndexRewriter(0),
62+
"ZREVRANGE": staticIndexRewriter(0),
63+
"ZDIFF": indexedRewriteExecutors(func(idx int, _ interface{}) bool { return idx > 0 }),
64+
"ZDIFFSTORE": indexedRewriteExecutors(func(idx int, _ interface{}) bool { return idx == 0 || idx > 1 }),
65+
"ZRANGESTORE": indexedRewriteExecutors(func(idx int, _ interface{}) bool { return idx < 2 }),
66+
}
4467

4568
serverExecutors = map[string]Executor{
4669
"FLUSHDB": flushDBExecutor{},

0 commit comments

Comments
 (0)