dalli-elasticache
dalli-elasticache copied to clipboard
Simplify configuration with an actual cache store
This allows one to do
config.cache_store = :dalli_elasticache_store, 'someendpoint.cfg.euw1.cache.amazonaws.com:11211', {:failover => true}
as suggested in #12
@fcheung Looks great, thanks so much. :smile:
Please add a test, and I'd be glad to merge this in.
cc @zmillman
@fcheung Did this actually enable you to configure elasticache with the running EC2/Beanstalk instance? How do I confirm that this is working?
Thanks Raghu
It does (sorry about not getting around to finishing it off. As far as confirming its working you could inspect Rails.cache in the console and also check that values are actually cached.
Thanks.I will try and keep up posted.
Raghu
@fcheung
I tried this change in production.rb and deploying to elastic beanstalk I get the following error in the console
[Instance: i-13ec4bdc] Command failed on instance. Return code: 1 Output: (TRUNCATED)...g/environment.rb:6:in <top (required)>' LoadError: cannot load such file -- active_support/cache/dalli_elasticache_store /var/app/ondeck/config/environment.rb:6:in
<top (required)>' Tasks: TOP => environment (See full trace by running task with --trace). Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/11_asset_compilation.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
Seems that dallI_elasticache_store is not loading, because of which deployment fails.
I went to console elastic-beanstalk and installed the gem dalli-elasticache, still no difference. Anything I may be missing?
Thanks Raghu
It would also need to be in your Gemfile. We've been using this in production for some time now.
@fcheung
It was there. Worked. Modified the config/initializers/session_store.rb for Rails >3.2.4 to put
Rails.application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 30.minutes
This did the trick.
Thanks for your help.
Raghu
Would love to see this get merged. All you're waiting on are specs, @ktheory?
@mattymess:
All you're waiting on are specs?
Yup, and would be nice to update the README too. Feel free to make an alternative PR if you'd like to pick this up.