title: Store Rails session using Redis
body: <p>The default session store for Rails is <code>cookie_store</code>. This makes the session be stored on the client side (correct me if I am wrong).</p>
  <p>I want to change this default behavior, so that I can store the sessions into Redis database.
  The posts/articles I found on the Internet, suggests setup a caching store to use <code>redis_cache_store</code> and then for the session_store, to use <code>cache_store</code>.</p>
  <p>As I got it, this means that, both caching and sessions will be using the same database (Instance). I don't want that. I want both sessions and cache to use different instances of Redis, so they can be configured accordingly.</p>
  <p>I tried to create an initializer file <code>config/initializers/session_store.rb</code> with the following content:</p>
  <pre class="lang-rb prettyprint-override"><code>Rails.application.config.session_store :redis_cache_store, key: '_my_app_session'
  
  </code></pre>
  <p>But this does not work. It gives me the following error:</p>
  <blockquote>
  <p>/application/configuration.rb:324:in `const_get': uninitialized constant ActionDispatch::Session::RedisCacheStore (NameError)</p>
  </blockquote>
  <p>I also found this gem <code>https://github.com/redis-store/redis-store</code> but I am not sure how problematic using this gem can be, since Rails already has a built-in Redis cache store (<a href="https://github.com/rails/rails/pull/31134" rel="nofollow noreferrer">https://github.com/rails/rails/pull/31134</a>)</p>