diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-08-02 10:34:23 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-08-02 10:35:18 -0400 |
commit | 60c39e470524ff53995887e8d13aa076b9744e68 (patch) | |
tree | 880fdd9ede91e9ea78597786100fceced4f521b4 | |
parent | 77c5f9481c5cf1cc548c73c71bd4723001d912f5 (diff) |
GC sessions one by one to make sure memcached gets cleared
-rw-r--r-- | classes/Session.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/classes/Session.php b/classes/Session.php index ac80279c5..a92ce405b 100644 --- a/classes/Session.php +++ b/classes/Session.php @@ -110,9 +110,18 @@ class Session extends Memcached_DataObject $session = new Session(); $session->whereAdd('modified < "'.$epoch.'"'); - $result = $session->delete(DB_DATAOBJECT_WHEREADD_ONLY); - self::logdeb("garbage collection result = $result"); + $session->find(); + + while ($session->fetch()) { + $other = new Session(); + $other->id = $session->id; + self::logdeb("Collecting session $other->id"); + $result = $other->delete(); + self::logdeb("garbage collection result = $result"); + } + + $session->free(); } static function setSaveHandler() |