I am using Apache Usergrid for a project. However I have a serious problem with its counters. It may take to 30 seconds for a counter to be updated. So I want to use something other than usergrid counters. My question is:
Is there a structure for redis, postgresql or memcached that I will be able to use hierarchical counters. Or is there any other tool for that purpose?
Thank you all.
There's no such counter in
Redis, but you can implement one with lua script.Each time you increment a counter with the name of "first.second.third", it automatically increments 3 counters: "first.second.third", "first.second", and "first".
hierarchical counter lua scripts: hc.lua
Try it with
redis-cli: