GET · Valkey

GET

Returns the string value of a key.

Usage

GET key

Description

Get the value of key. If the key does not exist the special value nil is returned. An error is returned if the value stored at key is not a string, because GET only handles string values.

Reply RESP2

One of the following:

Reply RESP3

One of the following:

Complexity

O(1)

ACL Categories

@fast @read @string

Examples

127.0.0.1:6379> GET nonexisting
(nil)
127.0.0.1:6379> SET mykey "Hello"
OK
127.0.0.1:6379> GET mykey
"Hello"

History

See also

APPEND, DECR, DECRBY, GETDEL, GETEX, GETRANGE, INCR, INCRBY, INCRBYFLOAT, LCS, MGET, MSET, MSETNX, SET, SETRANGE, STRLEN.