Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

GET

Last updated
GET key
Group
String
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

GET returns the string stored at key. Integers stored with SET or INCR come back as their decimal text. A missing key is not an error: the reply is nil.

Case RESP2 RESP3
The key holds a string Bulk string Bulk string
The key does not exist Nil bulk string Null

GET replies with a WRONGTYPE error when the key holds a value that is not a string.

127.0.0.1:6379> SET greeting "hello"
OK
127.0.0.1:6379> GET greeting
"hello"
127.0.0.1:6379> GET missing
(nil)
127.0.0.1:6379> RPUSH queue job1
(integer) 1
127.0.0.1:6379> GET queue
(error) WRONGTYPE Operation against a key holding the wrong kind of value

Same as Redis 7 and Valkey 8.

SET, MGET, GETEX, GETDEL, GETRANGE