Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MySQL scheduled event to remove Keystone authentication tokens expired for over one week.
USE keystone
-- This needs to be set in the my.cnf to persist
SET GLOBAL event_scheduler = 1;
DELIMITER $$
CREATE EVENT tokenreaper
ON SCHEDULE EVERY 1 WEEK
DO BEGIN
DELETE FROM `token` WHERE expires <= DATE_SUB(NOW(), INTERVAL 1 WEEK);
END $$
DELIMITER ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.