Class: Faraday::HttpCache::MemoryStore

Inherits:
Object
  • Object
show all
Defined in:
lib/faraday/http_cache/memory_store.rb

Overview

A Hash based store to be used by strategies when a ‘store` is not provided for the middleware setup.

Instance Method Summary collapse

Constructor Details

#initializeMemoryStore

Returns a new instance of MemoryStore.



9
10
11
# File 'lib/faraday/http_cache/memory_store.rb', line 9

def initialize
  @cache = {}
end

Instance Method Details

#delete(key) ⇒ Object



17
18
19
# File 'lib/faraday/http_cache/memory_store.rb', line 17

def delete(key)
  @cache.delete(key)
end

#read(key) ⇒ Object



13
14
15
# File 'lib/faraday/http_cache/memory_store.rb', line 13

def read(key)
  @cache[key]
end

#write(key, value) ⇒ Object



21
22
23
# File 'lib/faraday/http_cache/memory_store.rb', line 21

def write(key, value)
  @cache[key] = value
end