Class: Retriever::Storage::Ephemeral
- Inherits:
-
Object
- Object
- Retriever::Storage::Ephemeral
- Defined in:
- lib/retriever/storage/ephemeral.rb
Overview
Storage handler for a Hash Backend
Instance Attribute Summary collapse
-
#storage ⇒ Object
readonly
Instance of Hash.
Instance Method Summary collapse
-
#delete(key) ⇒ Object
Delete record in hash.
-
#get(key) ⇒ Object
Get record from hash.
-
#initialize ⇒ Ephemeral
constructor
Instantiate hash object as storage of cache.
-
#set(key, value) ⇒ Object
Set record in hash.
Constructor Details
#initialize ⇒ Ephemeral
Instantiate hash object as storage of cache.
10 11 12 |
# File 'lib/retriever/storage/ephemeral.rb', line 10 def initialize @storage = Hash.new end |
Instance Attribute Details
#storage ⇒ Object (readonly)
Instance of Hash
6 7 8 |
# File 'lib/retriever/storage/ephemeral.rb', line 6 def storage @storage end |
Instance Method Details
#delete(key) ⇒ Object
Delete record in hash.
28 29 30 |
# File 'lib/retriever/storage/ephemeral.rb', line 28 def delete(key) storage.delete(key) end |
#get(key) ⇒ Object
Get record from hash.
22 23 24 |
# File 'lib/retriever/storage/ephemeral.rb', line 22 def get(key) storage[key] end |
#set(key, value) ⇒ Object
Set record in hash.
16 17 18 |
# File 'lib/retriever/storage/ephemeral.rb', line 16 def set(key, value) storage[key] = value end |