TYPE(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’– NAME πŸ’–

type β€” the lil glow-up detective that tells you what kind of value is chillin' at a key πŸ”βœ¨


🌸 SYNOPSIS 🌸

TYPE key

πŸŽ€ DESCRIPTION πŸŽ€

Okay bestie, so here's the tea β˜• β€” TYPE hands you back the string representation of whatever type of value is living at key. Like, it doesn't give you the value itself, it gives you the vibe check of the value. It's giving "who dis" but make it technical πŸ’…

The different types it can return are:

  • string
  • list
  • set
  • zset
  • hash
  • stream

That's the whole roster, no cap πŸ‘‘ Six options, all iconic, all valid.


πŸ¦‹ REPLY πŸ¦‹

valkey-protocol(7) Simple string reply: the type of key, or none when key doesn't exist. Yeah, none β€” because sometimes the key just ghosted you πŸ™ˆπŸ˜­


✨ COMPLEXITY ✨

O(1)

Constant time, babes. It's fast fr fr, no scanning, no drama, just instant answers ⚑


🌈 ACL CATEGORIES 🌈

@fast @keyspace @read


πŸ’œ HISTORY πŸ’œ

  • Available since: 1.0.0 β€” an OG, been here since day one, true main character energy πŸ‘‘

⭐ EXAMPLES ⭐

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

See how that works?? Three keys, three totally different types, and TYPE clocked each one immediately πŸ”₯ key1 is a string, key2 is a list, key3 is a set. Slay.


🫢 SEE ALSO 🫢


And that's a wrap, bestie πŸŽ€ This was the TYPE(3valkey) page from the Valkey Command Manual, version 9.0.0, dated 2025-10-21. Go check your keys' types, stay curious, and remember: O(1) or it didn't happen πŸ’…βœ¨

πŸ“¦ where this page comes from