0
votes

When I start rails server locally (rails 5.2.0, ruby 2.5.1) with this configuration in develompent.rb

config.action_controller.perform_caching = true  
config.cache_store = :redis_cache_storage

with gem redis '4.0.1' installed

I've this error:

Traceback (most recent call last)

.rvm/gems/ruby-2.5.1@rails-test/gems/activesupport-5.2.0/lib/active_support/cache.rb:109:in `rescue in retrieve_store_class': Could not find cache store adapter for redis_cache_storage (cannot load such file -- active_support/cache/redis_cache_storage) (RuntimeError)

any ideas?

1
try using gem 'redis-rails', '~> 5' in your gem file.Hugo

1 Answers

0
votes

I'm not sure where you got :redis_cache_storage but that isn't going to work because it's not part of Rails; Rails doesn't include code to use Redis as a cache out-of-the-box. You need to use the redis-rails gem to use Redis as a cache for Rails:

Add this to your Gemfile:

gem 'redis-rails'

Then add this to your config:

# config/application.rb
config.cache_store = :redis_store, "redis://localhost:6379/0/cache", { expires_in: 90.minutes }

More information and options for configuring the gem can be found at https://github.com/redis-store/redis-rails.