Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

People also ask

What are session cookies?

The session cookie is a server-specific cookie that cannot be passed to any machine other than the one that generated the cookie. The session cookie allows the browser to re-identify itself to the single, unique server to which the client had previously authenticated.

What is rack session?

Rack::Session::Cookie provides simple cookie based session management. By default, the session is a Ruby Hash stored as base64 encoded marshalled data set to :key (default: rack. session). The object that encodes the session data is configurable and must respond to encode and decode .

What do you store in session cookies?

The server creates a “session ID” which is a randomly generated number that temporarily stores the session cookie. This cookie stores information such as the user's input and tracks the movements of the user within the website. There is no other information stored in the session cookie.


What are the different use cases of Rack::Session::Pool and Rack::Session::Cookie?

As far as I understand (correct me if I'm wrong):

  • Cookie stores all the session key:value pairs directly within the cookie (marshalled)
  • Pool only stores an id in the cookie, and maintains the rest of the session hash within @pool

So: what are the implications/reasons for choosing one over the other? what's @pool? Why does Pool need to expose a different public interface from Cookie? Why is the documentation so lacking?