Redis Type Command
The Redis Type command is used to return the type of the value stored at key.
Syntax
The basic syntax of the redis Type command is as follows:
redis 127.0.0.1:6379> TYPE KEY_NAME
Available Version
= 1.0.0
Return Value
Returns the data type of key. The possible data types are:
- none (key does not exist)
- string
- list
- set
- zset (sorted set)
- hash
Example
# 字符串
redis> SET weather "sunny"
OK
redis> TYPE weather
string
# 列表
redis> LPUSH book_list "programming in scala"
(integer) 1
redis> TYPE book_list
list
# 集合
redis> SADD pat "dog"
(integer) 1
redis> TYPE pat
set
Redis Key