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:34:23 -0400 |
commit | 34e8b25ceef890c0d1e41b75696b19e8b53db960 (patch) | |
tree | b6bf5e64ec4dbd7008b87a1dfe58b7fe5948db78 | |
parent | d5cc1357fdc90c70b0a71a04f9448abf558c3f94 (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() |