nodejs session 디자인
5885 단어 session
{
//
_data : {},
/** ***/
//
getSession : function(id){},
//
createSession : function(){},
//
replaceSession : function(source,target){},
//
destorySession : function(id){},
//
sharedSession : function(){},
/** ***/
//
initSessionGCProcessor : function(){},
//
intiSessionHeartbeatProcessor : function(){},
//
pushMessageProcessor : function(id){},
}
세 션 문맥
{
//
gcTime : 1000*60 *15,
//
hbTime : 1000*2,
//
msgMaxLength : 50
}
세 션 개체
var session = {
id:'xx',
state : 1, //
lastTime : new Date(), //
_attr :{}, //
_msg : [], //
getAllAttr : function(){ return this._attr; },
getAttr : function(key){ return this._attr[key]; }, //
removeAttr : function(key){ delete this._attr[key]; }, //
setAttr : function(key,value){ this._attr[key] = value; return this; }, //
write : function(msg){ this._msg.push(msg); }, //
getAndPushMsg : function(){ var result = this._msg; this._msg = []; return result; }, //
close : function(){ this.state = 0; }, //
destory : function(){ this.state = -1;}, //
replace : function(session){ this._attr = session.getAllAttr(); }, //
refreshLastTime : function(){ this.lastTime = new Date(); }, //
};
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
JWT로 세션을 관리하지 마십시오.세상에는 JWT(JOSE/JWS/JWE)로 세션 관리를 해서는 안 된다는 기사가 2017년부터 산 정도 있는데 왠지 JWT에서 세션 관리를 하려고 하는 사람이 있다. 번역 기사이거나 암호의 설명이 너무 길거나 해서,...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.