Redis stores data in the form of keys
and values
.
Value can be any string
or hashes
or any predefined
type
hashes allow you the mapping of key and value pairs. key and value are strings only. So, you can store the object type of data. It is similar to the HashMap data structure in the java language.
That means You can store the value as an object.
For example, In applications, you have a coded user object that contains the id, name, and salary in the program.
to cache users’ data, you can use value as user object in Redis.
Redis Hashes Commands
Command | Description |
---|---|
SET key value | Assign the value to the key |
GET key | Retrieve the value for the given key |
DEL key | Deletes the given key and value from a cache |