Im using redis to store tags for certain entities. Examples of the data:
+-------------+--------------------------------+
| key | value |
+-------------+--------------------------------+
| book:1:tags | [python, ruby, rails] |
+-------------+--------------------------------+
| book:2:tags | [fiction, fantasy] |
+-------------+--------------------------------+
| book:3:tags | [fiction, adventure] |
+-------------+--------------------------------+
How do I find all books with a particular tag, ie all books tagged with fiction?
You have to maintain reverse indexes yourself. Along with those keys that you posted, you should create reverse references.
Then it’s trivial to do what you want. But maybe you should consider using another tool for the job. For example, MongoDB can efficiently index and query arrays.