python - Remove old temporary files when user is logged out -
i have view takes logged in user input runs function produce report. result returned in html page. render report pdf well.
i create pdf content function , save in folder on server. don't want have server filled files every run, create temporary folder (in tmpfs) each user when log in , save path in session, not permanent.
session['temp_path'] = '/dev/shm/<random_uuid>/'
the user may log out clicking log out button, or session might expire. how can remove user's temporary folder after logged out?
clicking log out button same thing expiring session, right?
there 2 ways can this: 1) add code session expiration routine cleans temporary files, and/or 2) write cron
script checks active sessions , cleans temporary files inactive sessions.
Comments
Post a Comment