SORT_RO
SORT_RO key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC | DESC] [ALPHA]
- Group
- Server
- Complexity
- O(N + M log M) where N is the number of elements and M the number sorted
- Arity
- -2 (at least 2 words, counting the command name)
- Flags
- read-only, slow
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
SORT_RO is SORT without STORE. Because it never
writes, it is flagged read-only: you can send it to a replica, and ACL users
limited to read commands can run it. All other options and replies are those
of SORT.
Return value
Section titled “Return value”An array of bulk strings, with nil (RESP2) or null (RESP3) for a missing
GET value. An empty array when key does not exist. Passing STORE gets
ERR syntax error; the other errors are those of SORT.
Examples
Section titled “Examples”127.0.0.1:6379> RPUSH scores 30 4 120 15(integer) 4127.0.0.1:6379> SORT_RO scores DESC1) "120"2) "30"3) "15"4) "4"127.0.0.1:6379> SORT_RO scores STORE out(error) ERR syntax errorCompatibility
Section titled “Compatibility”Same as Redis 7 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.