kevy4.0

RANDOMKEY

Return a random key from the keyspace.

RANDOMKEY
Group
Keyspace scan
Since
1.0.0
Arity
exactly 1
Flags
readonly

Complexity

O(1) expected

Complexity and compatibility are read out of kevy's implementation, not copied from Redis's reference. Several genuinely differ.

Redis compatibility

Differs

the result is NOT random — each shard returns the first live key in hash-bucket order and the reducer takes the first shard's, so a fixed keyspace returns the same key every time; do not use it for sampling

See also

KEYSSCAN

← All commands