New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generalization of .getNanosToWaitForReset()
#187
Comments
Hello @helins
|
|
ok, now I understand your use case.
Different users want to add different additional information for API methods. For example:
It is impossible to cover all these feature requests, but fortunately, I have created the universal API that covers such requests without any library modifications. It is VerboseApi and its asynchronous analog.
Since I have a better understanding of your requirements, I would prefer to add method |
With version 6.4.0 desired behavior can be achieved in the following way: VerboseResult<Nothing> result = bucket.asVerbose().addTokens(1);
long waitForRefillNanos = result.getDiagnostics().calculateFullRefillingTime(); |
Ah, it was looking promising, exactly what I needed, unfortunately:
Indeed, the |
Ahh, I forgot to mark the interface as public. Fixed in version |
Thanks for your prompt action, works perfectly and does the job :) |
Hi, really good library, thanks a lot for your work!
I had to use the
7.0.0-beta-2020-04-18
release only because theConsumptionProbe
has this method. I am using Caffeine as a local cache for buckets and need this information to compute accurate TTLs on buckets every time tokens are consumed. By getting this full refill interval, a bucket can be safely marked as stale after this point in time: we know it will be full, so there is no point keeping it in memory.Some questions / comments:
ConsumptionProbe
; It would be useful obtaining this information (.getNantosToWaitForReset()
) outside of consumption probes.The text was updated successfully, but these errors were encountered: