Class: Sfn::Loader::HashCache
- Inherits:
-
Object
- Object
- Sfn::Loader::HashCache
- Defined in:
- lib/satisfaction/cache/hash.rb
Instance Method Summary collapse
- #get(url) ⇒ Object
-
#initialize ⇒ HashCache
constructor
A new instance of HashCache.
- #put(url, response) ⇒ Object
Constructor Details
#initialize ⇒ HashCache
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 |