TYPE

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Return the data type of a key

Usage: type key.
data type : string, list, set, zset, hash, stream

Example

Command>set mystr value   string  
Result>OK
Command>type mystr
Result>string
Command>lpush mylist value   list  
Result>1
Command>type mylist
Result>list
Command>sadd myset value   set  
Result>1
Command>type myset
Result>set
Command>zadd myzset value   zset(Sorted Set)  
Result>1
Command>type myzset
Result>zset
Command>hset myhash 0 value   hash  
Result>1
Command>type myhash
Result>hash


Syntax

TYPE key

  • Available since version 1.0.0.
  • Time complexity is O(1).
Related commands OBJECT
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< PERSISTS TYPE OBJECT >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.