We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently we store decrements in Redis. We first store the limit's threshold on miss and then decrement
Current SCRIPT_UPDATE_COUNTER script:
SCRIPT_UPDATE_COUNTER
local set_res = redis.call('set', KEYS[1], ARGV[1], 'EX', ARGV[2], 'NX') redis.call('incrby', KEYS[1], - ARGV[3]) if set_res then redis.call('sadd', KEYS[2], KEYS[1]) end
The idea is to completely decouple the counter from the limit and only store what happened, i.e. increments from 0 Something along these lines:
0
local c = redis.call('incrby', KEYS[1], ARGV[2]) if c == ARGV[2] then redis.call('expire', KEYS[1], ARGV[1], 'NX') redis.call('sadd', KEYS[2], KEYS[1]) end return c
Let's introduce this as another script and try leveraging it in our both our (Async)CounterStorages
(Async)CounterStorage
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Currently we store decrements in Redis. We first store the limit's threshold on miss and then decrement
Current
SCRIPT_UPDATE_COUNTER
script:The idea is to completely decouple the counter from the limit and only store what happened, i.e. increments from
0
Something along these lines:
Let's introduce this as another script and try leveraging it in our both our
(Async)CounterStorage
sThe text was updated successfully, but these errors were encountered: