Manage Rails session with Redis


This article shows how to manage Rails session with Redis.

🚕 Installation

Add the following to your Gemfile:

gem 'redis-rails'

🐹 Configuration

Set the following to config/initializers/session_store.rb:

MyApplication::Application.config.session_store :redis_store,
servers: ["redis://localhost:6379/0/session"],
expire_after: 90.minutes,
key: "_#{Rails.application.class.parent_name.downcase}_session",
threadsafe: false

🤔 References

🖥 Recommended VPS Service

VULTR provides high performance cloud compute environment for you. Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour). In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!