In redis-cli, what is the command to print all the values in a list without knowing in advance the size of the list? I see lrange
, but it requires naming the start index and the end index.
To list the keys in the Redis data store, use the KEYS command followed by a specific pattern. Redis will search the keys for all the keys matching the specified pattern.
Redis Get List Items. To get elements in a Redis, use the LRANGE command. This command takes the name of the list and the index range of the element you wish to access. The command should return the values of the elements in the specified range.
You can check the actual number by running redis-cli config get databases. In interactive mode, the database number is displayed in the prompt within square braces. For example, 127.0. 0.1:6379[13] shows that the 13th database is in use.
You can use COMMAND GETKEYS or COMMAND GETKEYSANDFLAGS to discover key names directly from how Redis parses the commands.
You use -1 to indicate end of list so:
LRANGE key 0 -1
would print all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With