Class: SessionCleanup
Instance Method Summary collapse
-
#initialize(sessions, interval, timeout) ⇒ SessionCleanup
constructor
A new instance of SessionCleanup.
Constructor Details
#initialize(sessions, interval, timeout) ⇒ SessionCleanup
Returns a new instance of SessionCleanup.
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 |
# File 'lib/rwd/rwd.rb', line 1097 def initialize(sessions, interval, timeout) every(interval) do sessions.delete_if do |id, session| time = Time.now.to_i - session.lastaccess.to_i puts "Session %s deleted" % id if time > timeout time > timeout end end end |