Code: Select all
IF ( UPDATE_SESSIONS ) {
Remove sessions older than ten minutes
} ELSE {
There is no current session - INSERT one
}If the page is refreshed too fast (so that both page calls have the same timestamp) the 2nd page errors for trying to INSERT a duplicate. Is there anyway to avoid this other than putting a try/catch around the INSERT statement?
Question #2
Are there any real benefits to change MySQL's type to MEMORY for the sessions table?