Skip to content

Instantly share code, notes, and snippets.

@twinge
Created February 12, 2009 17:07
Show Gist options
  • Save twinge/62735 to your computer and use it in GitHub Desktop.
Save twinge/62735 to your computer and use it in GitHub Desktop.
class SessionCleaner
def self.remove_stale_sessions
timeout = 360.minutes.ago
CGI::Session::ActiveRecordStore::Session.destroy_all( ['updated_at < ? ', timeout] )
Cart.destroy_all( ["user_id is null and updated_at < ?", timeout])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment