Add reap callback handler
Hello,
First off, thanks a ton for this project is has been very helpful. I've been working on something similar, but you've done a way better job. nice work!
How do you feel about adding a callback that gets called by the reap interval function when a session is expired? Take the scenario where i add a user id to the session and add the session id to the user. If I want to reap outdated sessions from my user i would be able to handle this within the reap callback. Obviously, it would be a non-required method that would only get called if defined.
I can issue a PR for it if the contributors are interested.
Thanks!
thanks and thanks also for your help. I'm not sure I understand - how would it be different than the already existing callback in the reap method?
Hey, thanks for the connector.
Line 63 uses the setInterval method to call the reap method every reapInterval milliseconds. How would I then be able to hook my own fn callback to this? Thanks again.
my 2c, because I wrote he reap function (#5), the callback that is in there now is only used by the tests, so in line 63, to hook in your own callback that would need to be passed as an option in the initialisation as in reapInterval.
I'd suggest following the convention of one other implementation like ca98am79/connect-dynamodb or tj/connect-redis - the callback could also return the number of sessions removed
Hey @fpereira1, thanks for the feedback. I checked the other implementations but it doesn't seem like they implement callbacks. I implemented the idea and requested a pull request #9. Thanks again.