Class: Socrates::Storage::Memory

Inherits:
Object
  • Object
show all
Includes:
Storage
Defined in:
lib/socrates/storage/memory.rb

Instance Method Summary collapse

Methods included from Storage

#fetch, #generate_key, #persist

Constructor Details

#initializeMemory

Returns a new instance of Memory.



8
9
10
# File 'lib/socrates/storage/memory.rb', line 8

def initialize
  @memory = {}
end

Instance Method Details

#clear(key) ⇒ Object



16
17
18
# File 'lib/socrates/storage/memory.rb', line 16

def clear(key)
  @memory.delete(key)
end

#clear_allObject



28
29
30
# File 'lib/socrates/storage/memory.rb', line 28

def clear_all
  @memory.clear
end

#get(key) ⇒ Object



20
21
22
# File 'lib/socrates/storage/memory.rb', line 20

def get(key)
  @memory[key]
end

#has_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/socrates/storage/memory.rb', line 12

def has_key?(key)
  @memory.has_key?(key)
end

#put(key, value) ⇒ Object



24
25
26
# File 'lib/socrates/storage/memory.rb', line 24

def put(key, value)
  @memory[key] = value
end