Redis Sorted Set - 一次检索得分低于和高于成员的成员的命令

Redis Sorted Set - command to retrieve members scored lower and higher than member at once

以下命令将使我得到最多 3 名成员的得分高于和最多 5 名成员的得分低于得分 100 的成员。

ZRANGEBYSCORE key -inf 100 limit 1 5 WITHSCORES
ZRANGEBYSCORE key 100 limit 1 3 WITHSCORES

有没有一种方法,不用脚本,只用一个命令从redis自动获取数据?

Is there a way, without scripting, to get the data atomically from redis with only one command?

"without scripting" - 是的,您可以使用交易(MULTI/EXEC 块)。

"only one command" - 不,除非您想开发一个实现该逻辑的 Redis 模块。