when to delete user's session
A cron job to clean up any expired session data in the database is a good thing.  Depending on how long your sessions last, and how big your database is, you might want to cleanup more often than once per day.  But one cleanup pass per day is usually fine.
I'm writing a webapp that will only be used by authenticated users. Some temporary databases and log files will be created during each user session. I'd like to erase all these temp files when the session is finished. 
Obviously, a logout or window close event would be sufficient to close the session, but in some cases the user may keep the browser open long after he's finished. 
Another approach would be to time user sessions or delete the temp files during routine maintenance.
How do you go about it?