TYPE

TYPE key
Available since:
Redis Open Source 1.0.0
Time complexity:
O(1)
ACL categories:
@keyspace, @read, @fast,
Compatibility:
Redis Software and Redis Cloud compatibility

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, stream, and vectorset.

Required arguments

key

The name of the key.

Examples

redis> SET key1 "value"
OK
redis> LPUSH key2 "value"
(integer) 1
redis> SADD key3 "value"
(integer) 1
redis> TYPE key1
string
redis> TYPE key2
list
redis> TYPE key3
set

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
✅ Standard
✅ Active-Active
✅ Standard
✅ Active-Active

Return information

Simple string reply: the type of key, or none when key doesn't exist.
RATE THIS PAGE
Back to top ↑