Redis Data Structures Tutorial
In this Redis tutorial we learn what data structures are in Redis and how it can help simplify a database.
Redis Data Structure
In a typical key:value database we set a string for both the keys and values. Redis allows us to use more complex data structures such as hashes, lists and sets.
As an example, let’s consider a database of employees. An employee may need to have multiple values associated with their key, like Name, Department etc.
We could structure our database with single key:value pairs and find ways to establish an association between the different values of a single employee.
emp-1-fname "John" emp-1-lname "Doe" emp-1-department "IT" emp-1-birthday "25 Jul"
However, this can easily lead to confusion and mistakes. Instead what we want is a single employee key with multiple values associated with it.
emp-1 fname "Jane" lname "Doe" department "Legal" birthday "2 Sep"
More complex data structures, like a hashmap, allows us to easily do this.