Example #1
0
 def removeSession(self, usr, sid):
     """删除Session"""
     """得到的是用户多次登录后的字典"""
     sessions = _mPool.get(usr, None)
     if sessions is not None and sessions.has_key(sid):
         userSessions = sessions[sid]
         del sessions[sid]
         return userSessions
     return None
Example #2
0
    def getSession(self, usr, sid):
        """从池中获取Session"""
        if _mPool.has_key(usr):
            sessions = _mPool.get(usr, None)
            # 清理过期session
#            if sessions is not None:
#                session = sessions.get(sid, None)
#                if(session is not None and self._isTimeOut(session)):
#                    self.removeSession(usr, sid)
#                else:
#                    return session
            if sessions is not None:
                return sessions.get(sid, None)
        return None
Example #3
0
 def getSessions(self, usr):
     sessions = _mPool.get(usr, None)
     if sessions is not None:
         return sessions
     return None