Plack::SessionをRedisに保存してみる
2013年6月18日
元になったソースは、Amon2の–flavor=Basicのスケルトンで作成されたapp.psgi。
とりあえず変更箇所だけメモ程度に。
ちなみに、Memcachedの場合は
Plack::SessionをMemcachedに保存してみる
↑こんな感じで。
use Plack::Session::Store::Redis;
use Plack::Session::State::Cookie;
builder {
enable 'Plack::Middleware::Session',
store => Plack::Session::Store::Redis->new(
prefix => 'MyApp',
host => 'localhost',
port => 6379,
expires => 604800, # 1week
),
state => Plack::Session::State::Cookie->new(
session_key => 'myapp_session',
httponly => 1,
expires => 604800, # 1week
);
}
最近はSessionをRedisに入れといた方がいいかなーと思ったりしてまする。