Sha256: b9ab724eeacd891d128c9c0d246088f1d84ff2040c302622f9c4e784313d5863
Contents?: true
Size: 635 Bytes
Versions: 11
Compression:
Stored size: 635 Bytes
Contents
module RailsPerformance class CurrentRequest attr_reader :request_id, :storage attr_accessor :record def CurrentRequest.init Thread.current[:rp_current_request] ||= CurrentRequest.new(SecureRandom.hex(16)) end def CurrentRequest.current CurrentRequest.init end def CurrentRequest.cleanup Thread.current[:rp_current_request] = nil end def initialize(request_id) @request_id = request_id @storage = [] @record = nil end def store(options = {}) @storage << options.merge(time: Time.now.to_i) end end end
Version data entries
11 entries across 11 versions & 1 rubygems