|
|
|
|
|
by winrid
2206 days ago
|
|
Store an object representing the namespace (customer+month) and use whatever your DB's increment operator is to increment the count for that month. Keep a map, or use an LRU cache, to check the DB periodically to see who has gone past their limit. You can also fire off this write to the DB asynchronously since you don't care that much if it fails and you don't want to create back pressure in your application. For example an object like {tenant, month, year, count}. Then you can reuse this for reporting etc which is what I do. We also track other metrics per customer + month like commenter sign ups, votes, etc. Also - I'm open to new opportunities right now if anyone's interested in hiring me. :) |
|