GC sessions one by one to make sure memcached gets cleared

This commit is contained in:
Evan Prodromou 2009-08-02 10:34:23 -04:00
parent d5cc1357fd
commit 34e8b25cee

View File

@ -110,11 +110,20 @@ class Session extends Memcached_DataObject
$session = new Session(); $session = new Session();
$session->whereAdd('modified < "'.$epoch.'"'); $session->whereAdd('modified < "'.$epoch.'"');
$result = $session->delete(DB_DATAOBJECT_WHEREADD_ONLY);
$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"); self::logdeb("garbage collection result = $result");
} }
$session->free();
}
static function setSaveHandler() static function setSaveHandler()
{ {
self::logdeb("setting save handlers"); self::logdeb("setting save handlers");