SlowCycle.de » 2010 » Mai


Simple Garbage Collection mit MySql Event Schedule

DROP EVENT IF EXISTS GARBAGE_COLLECTION;
DELIMITER $$

CREATE EVENT GARBAGE_COLLECTION
    ON SCHEDULE EVERY 30 SECOND DO
    BEGIN
        DELETE FROM session where expire < UNIX_TIMESTAMP(NOW());
    END $$

DELIMITER ;