Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is called session store?

What is called session store in context of web applications/websites ?

Is it anything more than a temporary store of session variables?

like image 828
Rajat Gupta Avatar asked Feb 01 '11 22:02

Rajat Gupta


1 Answers

Typically the user's first request to the site establishes a session. The session has a key which is passed to the user as a cookie, so that with every subsequent request the same session is retrieved.

The session store can store information about that user you don't want (or can't due to the length limit of cookies) to put in a cookie, for example the currently logged-in user ID or the contents of a shopping cart. This is usually in the form of some kind of serialized data structure depending upon the language/framework in use.

The reason why you might implement the session store in an external database rather than within the local web server would be to account for if you have multiple web servers in a pool; this way if the user's first request went to server A, and the next went to server B, your web app can still retrieve the same session data every time.

like image 138
Ben O Avatar answered Oct 29 '22 17:10

Ben O