Skip to main content

Description

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 none.

Method Signature

Parameters

key
string
required
The key to get the type of

Return Value

result
Type
The type of the key, one of:
  • "string" - String value
  • "list" - List
  • "set" - Set
  • "zset" - Sorted set
  • "hash" - Hash
  • "none" - Key does not exist

Examples

String type

List type

Hash type

Set type

Sorted set type

Non-existent key

Type-specific operations

See Also

  • exists - Check if a key exists
  • scan - Scan with type filtering