-
Notifications
You must be signed in to change notification settings - Fork 13
Session
Houfeng edited this page Jan 23, 2016
·
5 revisions
context.session.get("key",function(val){
//use val
};context.session.set("key","hello",function(){
//设置成功后的回调
});context.session.remove("key",function(){
//移动成功后的回调
});Nokit 默认内置了基于 Process Memory 的 SessionStore,但通过在 cluster 或多台服务器部署时,我们需要共享的 session,可以使用基于 redis 的 SessionStore
安装:
npm install nokit-session-redis -save
使用(配置 app.json):
{
...
"session": {
"provider": "nokit-session-redis",
"host": "localhost",
"port": 6379
}
...
}