pallets-eco / flask-session

Server side session extension for Flask
https://flask-session.readthedocs.io
BSD 3-Clause "New" or "Revised" License
501 stars 239 forks source link

Autodelete sessions in SqlAlchemySessionInterface #117

Closed Kolarovszki closed 7 months ago

Kolarovszki commented 4 years ago

The expired sessions are not deleted from the database in every case, so the autodeletion of expired sessions has been implemented.

Deletion of the expired sessions (e.g. with a cronjob) would be feasible in the application, but it is nicer to implement it directly in flask-session.

The autodeletion be enabled by the SESSION_AUTODELETE config variable, which defaults to False.

Major drawback: it slows down open_session.

bdouxx commented 3 years ago

hi, something is blocking this request? I'm very interested in this feature

Lxstr commented 7 months ago

Both these features is now included in 0.7.0 PR #212 as flask session_cleanup command and alternatively, SESSION_CLEANUP_N_REQUESTS. Also added direct TTL for mongo so there should be no cleanup required.