Created
October 16, 2016 11:41
-
-
Save marcelog/672cc10c1ba574adb3afb884e64d1337 to your computer and use it in GitHub Desktop.
Creating an event to remove sessions on expiration with MySQL events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE EVENT `remove_sessions_production` | |
ON SCHEDULE EVERY 1 MINUTE | |
DO DELETE FROM `production_db`.`session` WHERE UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - `last_activity` > 1800; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment