Redis: SET/GET Key:Value – Redis-CLI

Redis is a key-value database (also known as a key-value store) that uses a simple key/value method to store data.

Strings are the simplest data type in Redis and are simple key/value entries.

To save or fetch string data there are Redis SET and GET commands.

Redis SET command creates a key and assigns it some value (if the key already exists it just updates the value).

Redis GET command returns a value assigned to a key.

Cool Tip: List all keys from the all databases in Redis! Read more →

Redis: SET/GET Key:Value

Set a key and assign it a value:

$ redis-cli SET <key> <value>

Get a value associated to a key:

$ redis-cli GET <key>