Callback function for expired session for connect-redis in node.js

点点圈 提交于 2019-12-11 11:50:32

问题


I am using Connect on node.js with connect-redis as session store. Is there a way to attach a callback function to the the event when the session expires, so I can backup data from the session, before it gets deleted?


回答1:


Its impossible because the expiration is done at redis side. The connect-redis session store uses setex.

https://github.com/visionmedia/connect-redis/blob/master/lib/connect-redis.js#L80

You can set a insane maxAge and do expiration by yourself using setInterval

OR

Fork the module :)



来源:https://stackoverflow.com/questions/5422617/callback-function-for-expired-session-for-connect-redis-in-node-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!