Back to Redis

TYPE

content/commands/type.md

latest1.2 KB
Original Source

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.

Examples

{{% redis-cli %}} SET key1 "value" LPUSH key2 "value" SADD key3 "value" TYPE key1 TYPE key2 TYPE key3 {{% /redis-cli %}}

Redis Software and Redis Cloud compatibility

| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |

Return information

{{< multitabs id="type-return-info" tab1="RESP2" tab2="RESP3" >}}

Simple string reply: the type of key, or none when key doesn't exist.

-tab-sep-

Simple string reply: the type of key, or none when key doesn't exist.

{{< /multitabs >}}