Skip to main content
Retrieve the string value stored at a key. Returns (nil) if the key does not exist or has expired.

Syntax

GET key

Parameters

key
string
required
The name of the key to look up.

Return value

Returns the stored string value, or (nil) if the key is missing or has expired.

Errors

ConditionError message
Wrong number of arguments(error) wrong number of arguments for 'GET'

Examples

>>> SET name radish
OK
>>> GET name
radish

>>> GET missing
(nil)
Retrieving an expired key:
>>> SET temp hello EX 1
OK

# (after 1 second)
>>> GET temp
(nil)

Notes

GET implements passive expiry. If the key exists in memory but its TTL has elapsed, the key is deleted inline and (nil) is returned — no explicit sweep is required.
GET never updates a key’s TTL. Use SET with EX to reset expiry.

Build docs developers (and LLMs) love