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