Redis LLEN – How to get a length of the list in redis datastore
2 months ago Lalit Bhagtani 0
In this tutorial, we will learn about how to get the length of a list value stored at the key. For this, we will use Redis LLEN command.
This command returns the length ( number of elements ) of a list value stored at the key. If a key doesn’t exist in redis datastore, it is interpreted as an empty list and 0 is returned. The syntax of redis LLEN command is as follows :-
redis host:post> LLEN <key name>
(integer) value, representing the number of elements in the list. (integer) 0, if key does not exist. Error, if key exist and value stored at the key is not a list.
That’s all for how to get the length of a list value stored in redis datastore. If you liked it, please share your thoughts in comments section and share it with others too.