lib/active_sessions_helper.rb
# Clean up all expired sessions.
# This method can be called from the cron/scheduled job
Clean up all expired sessions.
This method can be called from the cron/scheduled job
Clean up all expired sessions . This method can be called from the cron / scheduled job
def cleanup
    logger.info("Cleaning up expired sessions...", :cleanup, { state: :starting })
    begin
      count = CacheStore.cleanup(ttl: SESSION_TTL)
      logger.info("Deleted #{count} expired sessions.", :cleanup, { state: :success, count: count })
    rescue StandardError => e
      logger.info("Failed to clean up expired sessions.", :cleanup, { state: :error, message: e.message })
      raise
    end
  end
def cleanup logger . info ( "Cleaning up expired sessions..." , :cleanup , { state : :starting } ) begin count = CacheStore . cleanup ( ttl : SESSION_TTL ) logger . info ( "Deleted #{count} expired sessions." , :cleanup , { state : :success , count : count } ) rescue StandardError => e logger . info ( "Failed to clean up expired sessions." , :cleanup , { state : :error , message : e . message } ) raise end end
Clean up all expired sessions.
Clean up all expired sessions .
# Reraise (calling `raise` without arguments will reraise last error)