Using `Rack::Session::Pool` over `Rack::Session::Cookie` Using `Rack::Session::Pool` over `Rack::Session::Cookie` ruby ruby

Using `Rack::Session::Pool` over `Rack::Session::Cookie`


You are right, Session::Cookie marshaling and store sessions in cookies.

Session::Pool instead keeps sessions in memory.

Pool has some advantages:

- faster, no marshaling needed - you can keep any objects with it(read ones that can not be marshaled)

But when you restart your app all sessions are lost.

With Cookie instead you will have restart-persistent sessions at the price of marshaling.

Alternatives - Session::Memcache, Session::Mongo