Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Type Command

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 Version

= 1.0.0

Return Value

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

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