Table of Content
Planning the tags data structure
You may be farmiliar with the traditional many-to-many relationship in SQL. But here what we have is just a key-value pair structure. Many-to-many relationship are done with set intersection.
Here is our data structure planning:
By using this structure, we can get the book list and all tags list directly.
And we can list all books of a given tag with the key in tag:<tag_name>
pattern.
If we want to list book in multi tags, we can interset the ISBNs arrays for the result.
Redis’ tutorials have more examples on how to use key-value pair structure.
Redis is a server side key-value database.
What’s next? We’re going to take a look at “Introducing Lo-Dash”.