Strings Get
# Redis Get Command
[!(#) Redis Strings](#)
The Redis GET command retrieves the value of a specified key. If the key does not exist, it returns `nil`. If the key holds a value of a type other than string, it returns an error.
### Syntax
The basic syntax of the Redis GET command is as follows:
redis 127.0.0.1:6379> GET KEY_NAME
### Available Versions
>= 1.0.0
### Return Value
Returns the value of the key; returns `nil` if the key does not exist. Returns an error if the key is not of string type.
### Example
# GET on a non-existent key or a key of string type redis> GET db (nil) redis> SET db redis OK redis> GET db "redis"# GET on a key that is not of string type 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
[!(#) Redis Strings](#)
YouTip