Computer >> Computer tutorials >  >> Programming >> Redis

Redis TYPE – How to get datatype of value store in key

In this tutorial, we will learn about how to get the datatype of a value store in the key. Values in redis datastore can be of different datatype like String, List, Set, Sorted Set etc. To get the data type of a value, we will use the COMMAND – TYPE in redis-cli. The syntax of redis TYPE command is as follows :-

Syntax :-

redis host:post> TYPE <key name>

Output :-

- string representing data type of a value.
- none, if key does not exist.

Example :-

Redis TYPE – How to get datatype of value store in key

References :-

  1. TYPE Command Docs

That’s all for how to get datatype of value store in the key in redis datastore. If you liked it, please share your thoughts in comments section and share it with others too.