jeremyFreeAgent / Bitter

Bitter is a simple but powerful analytics library
http://bitter.free-agent.fr
MIT License
129 stars 18 forks source link

Keep track of keys #3

Closed Seldaek closed 11 years ago

Seldaek commented 11 years ago

IMO the keys should be kept in two SETs bitter:keys and bitter_temp:keys. Whenever you write just do a SADD bitter:keys $key. That way removeAll/removeTemp can just be done by looping over all those keys instead of using the KEYS command to find them, because that is slow and on large databases can block the server for a while.

Seldaek commented 11 years ago

Alternatively, setting an expiry on the temp keys might be a preferred way to let nature do its work. removeAll would still need a KEYS call, but I don't really expect anyone to do that in prod.

jeremyFreeAgent commented 11 years ago

Yes, this is the point I spotted today. Thanks !

jeremyFreeAgent commented 11 years ago

And TTL is a good way ! Great ! You're the Redis guy !

jeremyFreeAgent commented 11 years ago

How to set a timeout in BITOP ? ping @Seldaek

Seldaek commented 11 years ago

You can't you have to call EXPIRE on the key after.

jeremyFreeAgent commented 11 years ago

Ok great ! I will push it at lunch time !

jeremyFreeAgent commented 11 years ago

Pushed !