LoginSignup
12
13

More than 5 years have passed since last update.

session store に Redis を使う

Last updated at Posted at 2012-12-26

あらかじめbrew install redis などで Redis をインストールしておく。

Gemfile

gem 'redis-rails'

config/initializers/session_store.rb

以下のような記述に変更する

RailsGameServer::Application.config.session_store :redis_store, :servers => { :host => "localhost", :port => 6379, :namespace => "sessions" }

ホスト名、ポートは適宜変更する。

保存されている内容の確認

redis-cli を起動して

> keys sessions*

とすると、保存されているキーが確認できる。さらに、

> get sessions:xxxxxxxxx <-上記で確認したキーの値とする

とすると、その内容を確認できる。

参考

12
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
13