thanhluanuit / redis-cache-store

Redis Cache Store in Rails 5.2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redis Cache Store in Rails 5.2

The Redis cache store takes advantage of Redis support for automatic eviction when it reaches max memory, allowing it to behave much like a Memcached cache server.

Add redis gem to Gemfile

  gem 'redis'

You can enable support for the faster hiredis connection library by additionally adding its ruby wrapper to your Gemfile:

  gem 'hiredis'

Finally, add the configuration in the relevant config/environments/*.rb file:

  config.cache_store = :redis_cache_store, { url: ENV['REDIS_URL'] }

Check redis keys on Rails console:

  Rails.cache.redis.keys

More details in: http://edgeguides.rubyonrails.org/caching_with_rails.html#activesupport-cache-rediscachestore

About

Redis Cache Store in Rails 5.2


Languages

Language:Ruby 78.4%Language:HTML 16.1%Language:JavaScript 3.4%Language:CSS 2.0%