Class: ErpTechSvcs::Sessions::DeleteExpiredSessionsService

Inherits:
Object
  • Object
show all
Defined in:
lib/erp_tech_svcs/sessions/delete_expired_sessions_service.rb

Instance Method Summary collapse

Constructor Details

#initializeDeleteExpiredSessionsService

Returns a new instance of DeleteExpiredSessionsService.



5
6
7
# File 'lib/erp_tech_svcs/sessions/delete_expired_sessions_service.rb', line 5

def initialize
  @session_age = ErpTechSvcs::Config.session_expires_in_hours.hours
end

Instance Method Details

#executeObject



9
10
11
# File 'lib/erp_tech_svcs/sessions/delete_expired_sessions_service.rb', line 9

def execute
  ActiveRecord::SessionStore::Session.delete_all ['updated_at < ?', @session_age.ago] 
end