Class: HTTParty::Cache::Store::Memory

Inherits:
Abstract
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/httparty/cache/store/memory.rb

Instance Attribute Summary collapse

Attributes inherited from Abstract

#options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract

#delete, #get, #key?, #marshal_dump, #marshal_load, #set

Constructor Details

#initializeMemory

Returns a new instance of Memory.



18
19
20
# File 'lib/httparty/cache/store/memory.rb', line 18

def initialize(**)
  clear
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



11
12
13
# File 'lib/httparty/cache/store/memory.rb', line 11

def store
  @store
end

Class Method Details

._load(_) ⇒ Object



26
27
28
# File 'lib/httparty/cache/store/memory.rb', line 26

def self._load(_)
  new
end

Instance Method Details

#_dump(_) ⇒ Object



22
23
24
# File 'lib/httparty/cache/store/memory.rb', line 22

def _dump(_)
  Marshal.dump(nil)
end

#clearObject



34
35
36
37
# File 'lib/httparty/cache/store/memory.rb', line 34

def clear
  @store = {}
  nil
end

#getset(key) ⇒ Object



30
31
32
# File 'lib/httparty/cache/store/memory.rb', line 30

def getset(key)
  store[key] ||= yield
end