TYPE key

Available since 1.0.0.

Time complexity: O(1)

Returns the string representation of the type of the value stored at key. The different types that can be returned are: string, list, set, zset, hash and stream.

*Return value

Simple string reply: type of key, or none when key does not exist.

*Examples

redis> SET key1 "value"

  1. "OK"

redis> LPUSH key2 "value"

  1. (integer) 1

redis> SADD key3 "value"

  1. (integer) 1

redis> TYPE key1

  1. "string"

redis> TYPE key2

  1. "list"

redis> TYPE key3

  1. "set"
redis>