I am writing a flask app that will count page views from multiple websites. I've decided to use Redis and Redispy but I am having a hard time deciding how to structure. Originally I tried to have a something like this
redis.set("date:YYYYMMDD:site:sitename", 1)
I want to be able to query by date, or by site name and display the count value. I tried to use .keys to query by date or by site name but the REDIS docs say to avoid using keys.
So then I thought maybe I can use redis hashes:
redis.hset("date:YYYYMMDD", "site", "sitename")
redis.hset("counter", 1)
Ultimately I want to be able run reports on site counters by site name, by date, or display all values from all dates. I can't seem to find the right structure to allow me get what I want.
Any suggestions would be greatly appreciated! I have not used REDIS before.