Skip to content
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

Do not reset counter expiration on incr/decr #160

Merged
merged 1 commit into from Jan 15, 2014
Merged

Do not reset counter expiration on incr/decr #160

merged 1 commit into from Jan 15, 2014

Conversation

rrb3942
Copy link
Contributor

@rrb3942 rrb3942 commented Jan 10, 2014

This patch makes it so that the localcache module does not reset the expiration of a key on an addition or subtraction. Instead the expiration is based off when the key was first inserted. For example, if you add 1 to a key every second and have it expire after 20 seconds, the counter will increase for 20 seconds and then be reset. The current behavior is that the counter will just continually increase and will not reset unless there is 20 seconds of inactivity on the key.

This behavior is more in-line with how other caches (such as memcache) treat these operations, and I believe should be the expected behavior. It also makes it much easier to use the localcache for things such as rate-limiting, loop detecting, etc without having to resort to interesting tricks in the keys (such as including the current second, minute, etc).

vladpaiu added a commit that referenced this pull request Jan 15, 2014
Do not reset counter expiration on incr/decr
@vladpaiu vladpaiu merged commit 11a74d7 into OpenSIPS:master Jan 15, 2014
vladpaiu added a commit that referenced this pull request Jan 15, 2014
Do not reset counter expiration on incr/decr(cherry picked from commit 11a74d7)
vladpaiu added a commit that referenced this pull request Jan 15, 2014
Do not reset counter expiration on incr/decr(cherry picked from commit 11a74d7)
vladpaiu added a commit that referenced this pull request Jan 15, 2014
Do not reset counter expiration on incr/decr(cherry picked from commit 11a74d7)
@vladpaiu
Copy link
Member

Hello,

Thanks for the patch, indeed the module behaviour was not in line with the other cachedb_* modules.
Applied and backported.

Best Regards,
Vlad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants