-
Notifications
You must be signed in to change notification settings - Fork 337
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
feature: support for ActiveSupport::MemCacheStore #153
Conversation
Hmm, there's a compatibility issue with Rails 3.x's |
Thanks for working on that. |
I've investigated this a bit, and there's an inconsistency in Rails 3.x, with When using the Rails 3.2 ( Rails.cache.delete("foo")
Rails.cache.increment("foo") # => 0 Whereas with every other cache stores, such as I'm not sure it's a good idea to deal with that specificity in I could create a new |
I've addressed the issue by creating a dedicate MemCacheProxy class for the The original reason for this PR is still solved, and now everything should work well even for Rails 3.2! |
👍 |
@elhu Very cool. Didn't realize dalli didn't support I'll review this as soon as I can (probably in the next couple weeks.) If you can report success running this patch in a production application, that'd be helpful testing. |
I'm on vacation this week, but I can start testing things out on a production app starting the week after that. I'll adjust the PR if I find any issues, and report here if I don't find any. |
I've brought my branch up to date with master, and fixed a couple more things. I am also running the patch on a live web-app, and have no problems to report so far. |
@ktheory did you get a chance to review this? |
@@ -3,6 +3,7 @@ | |||
source "https://rubygems.org" | |||
|
|||
gem "activesupport", "~> 3.2.0" | |||
gem "memcache-client" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add memcache-client
as a development dependency instead?
This file is auto-generated from Appraisals
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've addressed that. Didn't know about appraisal
, very interesting stuff!
I've also refactored the Rack::Attack::StoreProxy.build
method, which was getting too cluttered in my opinion (but I could move that to a separate PR if you think it's necessary).
I had to revert my refactoring of |
@ktheory Is there anything more you would like to discuss regarding this PR? |
@elhu Looks good! 🍰 I'll aim to publish a new release by the end of the week. |
feature: support for ActiveSupport::MemCacheStore
Great, thanks! |
Just shipped v4.4.0: https://rubygems.org/gems/rack-attack/versions/4.4.0 |
Brilliant, thank you very much! |
Hello,
This PR adds support for
ActiveSupport::Cache::MemCacheStore
, which is Rails' wrapper aroundDalli
.Because of
Dalli
lack of support forrace_condition_ttl
, we're stuck withMemCacheStore
... hence this PR!