Resetting token consumptions everyday and maintaining history #182
-
Hello, I am using this library with Rest API to restrict api calls against token, e.g. client can call api max 1000 times daily for this |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello @haiderali22
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.
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 independently. |
Beta Was this translation helpful? Give feedback.
Hello @haiderali22
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.
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…