什么叫会话商店? [英] What is called session store?

查看:124
本文介绍了什么叫会话商店?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Web应用程序/网站的上下文中称为会话存储?

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

它不仅仅是会话变量的临时存储吗?

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

推荐答案

通常,用户对站点的第一个请求会建立会话。会话有一个密钥,它作为cookie传递给用户,因此每次后续请求都会检索到相同的会话。

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.

会话存储可以存储有关该信息的信息。您不希望(或由于cookie的长度限制而无法)放入cookie的用户,例如当前登录的用户ID或购物车的内容。这通常采用某种序列化数据结构的形式,具体取决于所使用的语言/框架。

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.

您可能在外部数据库中实现会话存储的原因而不是在本地Web服务器中,如果池中有多个Web服务器,则会考虑到这一点;这样,如果用户的第一个请求转到服务器A,然后下一个请求转到服务器B,那么您的Web应用程序仍然可以每次检索相同的会话数据。

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.

这篇关于什么叫会话商店?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆