don't write session if it's unchanged

This commit is contained in:
Evan Prodromou 2009-10-09 10:39:56 -04:00
parent f46084309b
commit 3727b17c39

View File

@ -85,9 +85,18 @@ class Session extends Memcached_DataObject
return $session->insert(); return $session->insert();
} else { } else {
if (strcmp($session->session_data, $session_data) == 0) {
self::logdeb("Not writing session '$id'; unchanged");
return true;
} else {
self::logdeb("Session '$id' data changed; updating");
$orig = clone($session);
$session->session_data = $session_data; $session->session_data = $session_data;
return $session->update(); return $session->update($orig);
}
} }
} }