Understanding Redis
Redis is an open source in-memory data structure. Redis fits well for a database cache and is not common, but it can be used as a message broker using the publish-subscribe feature, it can be useful to decouple applications.
There are some interesting features supported by Redis such as transactions, atomic operations, and support for time-to-live keys. Time-to-live is useful for giving a time for the key, the eviction strategy is always hard to implement, and Redis has a built-in solution for us.
Data types
There are a lot of supported data types by Redis. The most common ones are strings, hashes, lists, and sorted sets. We will understand each of these a little bit because it is important to help us to choose the correct data type for our use case.
Strings
Strings are the more basic data type of Redis. The string value can be at max 512 MB in length. We can store it as a JSON in the value of the key, or maybe as an image as well because the Redis is binary safe.