-
I've just started using hono_sessions and wondering if there is any documentation hidden away somewhere aside from what is in the readme.md file? I am specifically having an issue where my session data is not being cleared from my bun:sqlite database automatically, even after sessions expire. Is this by design, or should the data be automatically purged? If we have to manage this manually, are there any functions we can utilize to clear expired sessions (and revoke sessions if required)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Old sessions aren't automatically purged, but the expiration is attached to the If the user tries to access an expired session, it will delete the old session and create a fresh new one. However, if the cookie has been set with a At some point, I might write some docs on how to do this with various databases. Or, create some database-agnostic cleanup method. |
Beta Was this translation helpful? Give feedback.
Old sessions aren't automatically purged, but the expiration is attached to the
_expire
property of the session JSON object stored in the database. With this, you could write a script or cron job to loop through thesessions
table and delete sessions that haven't been used for a while.If the user tries to access an expired session, it will delete the old session and create a fresh new one. However, if the cookie has been set with a
Max-Age
orExpires
attribute that is ahead of the sessionexpireInSeconds
property, the old session will become stale and will have to be cleaned up such as with the method above.At some point, I might write some docs on how to do this with various databases.…