lib/include/class_session.rb in knjappserver-0.0.16 vs lib/include/class_session.rb in knjappserver-0.0.17
- old
+ new
@@ -21,11 +21,15 @@
d.data[:date_added] = Time.now if !d.data[:date_added]
d.data[:date_lastused] = Time.now if !d.data[:date_lastused]
end
def flush
- self.update(
- :sess_data => Base64.encode64(Marshal.dump(@sess_data)),
- :date_lastused => Time.now
- )
+ flush_data = Base64.encode64(Marshal.dump(@sess_data))
+
+ if self[:sess_data] != flush_data
+ self.update(
+ :sess_data => flush_data,
+ :date_lastused => Time.now
+ )
+ end
end
end
\ No newline at end of file