Class: Faraday::HttpCache::MemoryStore

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

Overview

Internal: A Hash based store to be used by the ‘Storage’ class when a ‘store’ is not provided for the middleware setup.

Instance Method Summary collapse

Constructor Details

#initializeMemoryStore

Returns a new instance of MemoryStore.



177
178
179
# File 'lib/faraday/http_cache/storage.rb', line 177

def initialize
  @cache = {}
end

Instance Method Details

#delete(key) ⇒ Object



185
186
187
# File 'lib/faraday/http_cache/storage.rb', line 185

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

#read(key) ⇒ Object



181
182
183
# File 'lib/faraday/http_cache/storage.rb', line 181

def read(key)
  @cache[key]
end

#write(key, value) ⇒ Object



189
190
191
# File 'lib/faraday/http_cache/storage.rb', line 189

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