Class: Hurley::HttpCache::MemoryStore
- Inherits:
-
Object
- Object
- Hurley::HttpCache::MemoryStore
- Defined in:
- lib/hurley/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
- #delete(key) ⇒ Object
-
#initialize ⇒ MemoryStore
constructor
A new instance of MemoryStore.
- #read(key) ⇒ Object
- #write(key, value) ⇒ Object
Constructor Details
#initialize ⇒ MemoryStore
Returns a new instance of MemoryStore.
132 133 134 |
# File 'lib/hurley/http_cache/storage.rb', line 132 def initialize @cache = {} end |
Instance Method Details
#delete(key) ⇒ Object
140 141 142 |
# File 'lib/hurley/http_cache/storage.rb', line 140 def delete(key) @cache.delete(key) end |
#read(key) ⇒ Object
136 137 138 |
# File 'lib/hurley/http_cache/storage.rb', line 136 def read(key) @cache[key] end |
#write(key, value) ⇒ Object
144 145 146 |
# File 'lib/hurley/http_cache/storage.rb', line 144 def write(key, value) @cache[key] = value end |