开发者

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

开发者 https://www.devze.com 2023-02-19 07:05 出处:网络
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

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 de开发者_高级运维leted?


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 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号