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?