English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Redis GET command is used to retrieve the value of a specified key. If the key does not exist, nil is returned. If the value stored in the key is not a string type, an error is returned.
The basic syntax of the Redis GET command is as follows:
redis 127.0.0.1:6379> GET KEY_NAME
>= 1.0.0
Returns the value of the key, or nil if the key does not exist. If the key is not a string type, an error is returned.
# GET against a non-existent key or a string-type key redis> GET db (nil) redis> SET db redis OK redis> GET db "redis" # GET against a key that is not a string redis> DEL db (integer) 1 redis> LPUSH db redis mongodb mysql (integer) 3 redis> GET db (error) ERR Operation against a key holding the wrong kind of value