diff options
author | Evan Prodromou <evan@status.net> | 2009-10-09 10:39:56 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-10-09 10:39:56 -0400 |
commit | 88e7092d2326403ab5cb0c7261b665154491e75c (patch) | |
tree | 8104cfc2ae6318b9066a29104756ddc3e92b5529 /classes/Session.php | |
parent | a6d4adc398d9d2d131df97007452c5c54072ddec (diff) |
don't write session if it's unchanged
Diffstat (limited to 'classes/Session.php')
-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 d641edbbe..79a69a96e 100644 --- a/classes/Session.php +++ b/classes/Session.php @@ -85,9 +85,18 @@ class Session extends Memcached_DataObject return $session->insert(); } else { - $session->session_data = $session_data; + 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; - return $session->update(); + return $session->update($orig); + } } } |