sidebase / nuxt-session

Nuxt session middleware to get a persistent session per app user, e.g., to store data across multiple requests. The nuxt session module provides the useSession() composable out of the box and sets up API endpoints to interact with your session to make working with sessions feel like a breeze.
https://sidebase.io/nuxt-session/
MIT License
189 stars 19 forks source link

Cleanup expired sessions #25

Open valiafetisov opened 1 year ago

valiafetisov commented 1 year ago

Describe the feature

Currently, expired sessions are not deleted until the user with the matching session.id comes back. Especially in case of the memory driver it can lead to memory leaks. The solution is to periodically clean up expired sessions independently from the request. I assume simple cron job will be sufficient here.

Additional information

Note: the idea is originated from the discussion in https://github.com/sidebase/nuxt-session/pull/16#discussion_r1017843739