Class: Sfn::Loader::HashCache

Inherits:
Object
  • Object
show all
Defined in:
lib/satisfaction/cache/hash.rb

Instance Method Summary collapse

Constructor Details

#initializeHashCache

Returns a new instance of HashCache.



2
3
4
# File 'lib/satisfaction/cache/hash.rb', line 2

def initialize
  @cached_responses = {}
end

Instance Method Details

#get(url) ⇒ Object



11
12
13
# File 'lib/satisfaction/cache/hash.rb', line 11

def get(url)
  @cached_responses[url.to_s]
end

#put(url, response) ⇒ Object



6
7
8
9
# File 'lib/satisfaction/cache/hash.rb', line 6

def put(url, response)
  return nil if response["ETag"].blank?
  @cached_responses[url.to_s] = Sfn::Loader::CacheRecord.new(url, response["ETag"], response.body)
end