TYPE
TYPE key
- Group
- Keys
- Complexity
- O(1)
- Arity
- 2 (exactly, counting the command name)
- Flags
- read-only, fast
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
TYPE returns the name of the type of the value at key, or none when the
key does not exist. Looking up the type is not an access to the key.
| Reply | Value type |
|---|---|
string |
String (also bitmaps and HyperLogLogs) |
list |
List |
set |
Set |
zset |
Sorted set |
hash |
Hash |
stream |
Stream |
MBbloom-- |
Bloom filter |
CMSk-TYPE |
Count-min sketch |
TopK-TYPE |
Top-K |
none |
The key does not exist |
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Always | Simple string: the type name | Simple string |
Examples
Section titled “Examples”127.0.0.1:6379> SET name "ada"OK127.0.0.1:6379> RPUSH queue job1(integer) 1127.0.0.1:6379> TYPE namestring127.0.0.1:6379> TYPE queuelist127.0.0.1:6379> TYPE missingnoneCompatibility
Section titled “Compatibility”The core type names are the same as in Redis 7 and Valkey 8. The Bloom filter, count-min sketch and Top-K names are the ones Redis Stack reports for those types.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.