Sha256: 59e192be5c2b546c14b7653265671659dd28c851f7ff323788156220bbce64b8

Contents?: true

Size: 797 Bytes

Versions: 9

Compression:

Stored size: 797 Bytes

Contents

require 'speedup-adapters'

module Speedup

  class Request

    def self.connection
      Speedup.adapter
    end

    def self.get(request_id)
      connection.get(request_id)
    end

    def initialize(request_id)
      @request_id = request_id
    end

    def id
      @request_id
    end

    def data
      @data ||= RequestData.new
    end

    def save
      Speedup.temporary_disabled = false
      return unless data.any?
      self.class.connection.write(id, data)
    end


    def store_event(key, evt_data)
      method = "store_#{key}"
      if key == :request
        data.storage_for(key).merge!(evt_data)
      elsif respond_to?(method)
        send(method, evt_data)
      else
        storage = data.storage_for(key)
        storage << evt_data
      end
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
speedup-rails-0.0.15 lib/speedup/request.rb
speedup-rails-0.0.13 lib/speedup/request.rb
speedup-rails-0.0.12 lib/speedup/request.rb
speedup-rails-0.0.10 lib/speedup/request.rb
speedup-rails-0.0.9 lib/speedup/request.rb
speedup-rails-0.0.7 lib/speedup/request.rb
speedup-rails-0.0.6 lib/speedup/request.rb
speedup-rails-0.0.3 lib/speedup/request.rb
speedup-rails-0.0.2 lib/speedup/request.rb