Skip to content

Resetting token consumptions everyday and maintaining history #182

Discussion options

You must be logged in to vote

Hello @haiderali22

For resetting it is better to reset the bucket manually or let library do it automatically.

Currently, there is no reset method in the API, so the library can not do for you. The easiest way to reset will be just removing cache entries, then the bucket state will be recreated when will be detected that cache entry is missed.

second for stats i can user listener and save the event to database and i the end of day compute statistics or there is a better way?

If you can not afford to miss consumption events, then it will be the best way, but I suppose one optimization - just use counters with a primary key(user, day) instead of storing each consumption event independen…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by haiderali22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants