Sunday 20 November 2016

How to get a random key in redis

Sometimes when we are on the redis prompt on an unknown database, we need to see some random key to know what sort of keys exist in this redis instance.
We can try the "keys *" command but it scans all the keys.
To get a random key, redis "randomkey" command can be used, as documented here.


As expected randomkey returns a random key from the dataset.



No comments:

Post a Comment