class AWS::Core::ResponseCache

@private

Attributes

cached_responses[R]
resource_cache[R]

Public Class Methods

new() click to toggle source
# File lib/aws/core/response_cache.rb, line 24
def initialize
  @cached_responses = []
  @indexed_responses = {}
  @resource_cache = ResourceCache.new
end

Public Instance Methods

add(resp) click to toggle source
# File lib/aws/core/response_cache.rb, line 30
def add(resp)
  cached_responses.unshift(resp)
  @indexed_responses[resp.cache_key] = resp if
    resp.respond_to?(:cache_key)
  @resource_cache = ResourceCache.new
end
cached(resp) click to toggle source
# File lib/aws/core/response_cache.rb, line 44
def cached(resp)
  @indexed_responses[resp.cache_key]
end
select(*types, &block) click to toggle source
# File lib/aws/core/response_cache.rb, line 37
def select(*types, &block)
  cached_responses.select do |resp|
    types.map{|t| t.to_s }.include?(resp.request_type.to_s) and
      (block.nil? || block.call(resp))
  end
end