如何使Zend会话存储在可用方法之间具有持久性? [英] how can we make Zend session storage as persistent among available methods?

查看:77
本文介绍了如何使Zend会话存储在可用方法之间具有持久性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Zend身份验证会话存储系统有些困惑.我将尝试解释我的问题.请尝试表达您的意见或对zend会话或我的假设和问题的任何了解.

I am little bit confused about Zend authentication session storage system. I will try to explain my problem. Please try to express your opinion or anything you know about zend session or my assumptions and questions.

默认情况下,Zend_Auth_Adapter_DbTable在成功身份验证后将提供的身份返回给auth对象. 如果我使用getStorage()或getIdentity(),则可以检索某些变量的会话值(id,名称,..)". !! 如果您认为以上两个假设都是正确的,那么我的问题是

By default, Zend_Auth_Adapter_DbTable returns the identity supplied back to the auth object upon successful authentication. If I use getStorage() or getIdentity(), so I can able to retrieve "Session values(id, name,..)" to some variables. !! If you think above both assumption are right, my questions are,

  1. 默认情况下,会话值存储在哪里? (默认情况下,它用于存储会话的位置是什么?)
  2. 如果我指定会话保存路径,如下所示.如果会话根据问题1存储,为什么我们需要将这些会话存储在文件夹中? save_path =/home/myaccount/zend_sessions/myapp
  3. 如果我使用Zend_Session_SaveHandler_DbTable.是什么让它比上面的两个选项更好?
  4. 或者,您能否提出您的想法,我们可以使会话在Zend中持久存在?目前我们已经有100万用户注册,那么如何有效地进行用户会话存储呢?
  1. Where session values stores by default? (By default, which place it uses to store the session?)
  2. If I specify session save path like below. Why should we need to store these session in a folder if session stores according question 1? save_path = /home/myaccount/zend_sessions/myapp
  3. if I use Zend_Session_SaveHandler_DbTable. What makes it better than above two options?
  4. Or, can you able to suggest which way you think, we can make the session persistent in Zend ? Currently we got 1 million users registered with us,so how can we make the users session storage in efficient way?

在此先感谢所有参加讨论的人员,如果您认为我的任何问题或假设是错误的,请尝试表达自己的观点.这样我就可以从错误中学习

Thanks in advance to all of you who are going to participate in discussion, if you think any of my questions or assumptions are wrong, please try to express your way. So I can able to learn from mistakes

推荐答案

  1. Zend会话内部使用php全局变量$ _SESSION,保存会话的路径由php.ini设置控制,因此您可以使用对于session_save_path,您可以在需要保存会话的位置提供文件夹名称.默认情况下,会话存储在temp文件夹中,每次有人清除temp文件夹会话时,数据都会丢失.因此最好使用其他文件夹.

    For session_save_path you can give folder name where you need to save session. By default session stores in temp folder, every time somebody clears temp folder sessions data will be lost. So its better to use other folder.

    Db会话用于会话共享.在Google之类的大型网站中,一台服务器无法满足所有用户的请求,因此,如果您请求了某些内容,则将创建会话并获得响应,对于下一个请求,无法保证您将访问同一台服务器,在这种情况下,第二台服务器尝试从某个分布式位置(如db或memcache)中获取会话数据.对于分布式会话,Memcache比db是最好的选择,因为它更快.

    Db sessions are used for session sharing. In large websites like google, one server wont serve all users requests, so if you requested something, session will get created and you will get response, for your next request there is no guarantee that you will hit the same server, in that case the 2nd server tries to fetch the session data from some distributed location like db or memcache. Memcache is best option than db for distributed session, as it is more faster.

    您要在会话中保存的信息是什么,如果您想要将其保存更长的时间,那么为什么不能将这些信息与用户对象相关联而不是在会话中保存.

    What information you are trying to save in session, if its something you are trying to save for longer time then why can`t you associate that information with user object instead of saving in session.

    这篇关于如何使Zend会话存储在可用方法之间具有持久性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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