Redis Keys: RANDOMKEY
Redis RANDOMKEY Command
Redis RANDOMKEY command is used to get a random key from currently selected redis database.
Here are some common uses and scenarios for the "RANDOMKEY" command:
- Sampling: Select random keys for statistical analysis or sampling purposes.
- Load Testing: Randomly access keys to simulate load on the Redis instance.
- Monitoring: Inspect random keys to check for unexpected or outlier data.
- Debugging: Retrieve random keys for troubleshooting or debugging purposes.
Syntax:
RANDOMKEY
Available since
1.0.0.
Return Value
Bulk String reply:
a random key or nil, if a database is empty.
Return Value Type
String
Example: Redis RANDOMKEY
First, create some keys in redis and set some values in it.
127.0.0.1:6379[1]> RANDOMKEY "KEY" 127.0.0.1:6379[1]> RANDOMKEY "key1"
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics