SORT_RO

SORT_RO

SORT_RO key [BY] [LIMIT] [GET] [ASC | DESC] [ALPHA]
Available since
7.0.0
Time complexity
O(N+M*log(M)) where N is the number of elements in the list or set to sort, and M the number of returned elements. When the elements are not sorted, complexity is O(N).
ACL categories
@read, @set, @sortedset, @list, @slow, @dangerous

Read-only variant of the SORT command. It is exactly like the original SORT but refuses the STORE option and can safely be used in read-only replicas.

Since the original SORT has a STORE option it is technically flagged as a writing command in the Redict command table. For this reason read-only replicas in a Redict Cluster will redirect it to the master instance even if the connection is in read-only mode (see the READONLY command of Redict Cluster).

The SORT_RO variant was introduced in order to allow SORT behavior in read-only replicas without breaking compatibility on command flags.

See original SORT for more details.

Examples #

SORT_RO mylist BY weight_*->fieldname GET object_*->fieldname

Redict logo courtesy of @janWilejan, CC-BY-SA-4.0. Download SVG ⤑

Portions of this website courtesy of Salvatore Sanfilippo, CC-BY-SA-4.0.