alexedwards / scs

HTTP Session Management for Go
MIT License
2.09k stars 166 forks source link

Add Hooks for cleanup process #94

Closed tiger5226 closed 2 years ago

tiger5226 commented 4 years ago

Some information from sessions might want to be stored per user long term. For example, start and end of a session is important information.

alexedwards commented 3 years ago

Sorry for the terribly slow reply.

This is quite a nice idea, but it's currently possible by creating your own store implementation with the necessary cleanup logic by copying (or even just embedding!) one of the existing ones.

If you're motivated to make the necessary code changes to all the existing SCS store repositories (in a non-breaking way) to support hooks, then I'd be happy to accept a PR (though please write back to discuss the design of the hooks before doing any work).

Otherwise, I'm inclined to close the issue as I feel there is a reasonable work around to achieve the behaviour (i.e. implement your own store).

alexedwards commented 3 years ago

@tiger5226 I'd like to finalize what, if anything, needs to be done on this issue. I think that creating a custom Store instance with the necessary cleanup hooks is a pragmatic way to achieve this, but if you have the time and inclination to implement the hook logic in the existing session stores and send a PR I'm happy to keep this open.

alexedwards commented 2 years ago

To keep the issues list clean I'm going to close this. If you'd like to work on it, or think that further discussion is needed, please feel free to re-open.