Class: Retriever::Storage::Ephemeral

Inherits:
Object
  • Object
show all
Defined in:
lib/retriever/storage/ephemeral.rb

Overview

Storage handler for a Hash Backend

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEphemeral

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

#storageObject (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