Redis Type Command

Redis key

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 versions

>= 1.0.0

Return value

Returns the data type of the key. The data types are:

  • none (key does not exist)
  • string
  • list
  • set
  • zset (sorted set)
  • hash

Examples

# 字符串

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

Other extensions