Before we build anything, we will cover what data structures Redis supports. We can then discuss what we are building from these structures. Redis is not a database, so it does not have the familiar VARCHAR
, INT
, DATETIME
, or anything like that. Redis is a key-value store. You have a key and you can look up the value of what is stored there. Redis supports a few low-level data types. The first type that we are going to discuss is a string.
Strings are the most basic type and are often the type that we are going to use. Usually, we can serialize almost any data type to a string. If we recall when we used Connect to move the sessions to Redis, we will see that Connect just serializes JSON and stores it as a string. This is always an option. The string type also doubles as an integer. There is no specific integer type, so integers are stored as strings.
The next data type is a hash. This type allows us to store information in fields in the hash. For example, a user...