1

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?

rgettman
  • 176,041
  • 30
  • 275
  • 357
Thomas
  • 10,289
  • 13
  • 39
  • 55

1 Answers1

5

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

masylum
  • 22,091
  • 3
  • 20
  • 20