dalli-elasticache icon indicating copy to clipboard operation
dalli-elasticache copied to clipboard

Simplify configuration with an actual cache store

Open fcheung opened this issue 9 years ago • 9 comments

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 avatar Apr 26 '15 18:04 fcheung

@fcheung Looks great, thanks so much. :smile:

Please add a test, and I'd be glad to merge this in.

cc @zmillman

ktheory avatar May 31 '15 19:05 ktheory

@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

raghvendras73 avatar Oct 22 '15 07:10 raghvendras73

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.

fcheung avatar Oct 22 '15 07:10 fcheung

Thanks.I will try and keep up posted.

Raghu

raghvendras73 avatar Oct 22 '15 11:10 raghvendras73

@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

raghvendras73 avatar Oct 23 '15 06:10 raghvendras73

It would also need to be in your Gemfile. We've been using this in production for some time now.

fcheung avatar Oct 23 '15 07:10 fcheung

@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

raghvendras73 avatar Oct 23 '15 07:10 raghvendras73

Would love to see this get merged. All you're waiting on are specs, @ktheory?

mattymess avatar Feb 26 '16 22:02 mattymess

@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.

ktheory avatar Mar 04 '16 12:03 ktheory