Class: Cacheable::TestCache

Inherits:
Object
  • Object
show all
Defined in:
lib/cache_utils.rb

Constant Summary collapse

@@cache_storage =
{}
@@cache_instance =
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject



16
17
18
# File 'lib/cache_utils.rb', line 16

def self.instance
  @@cache_instance ||= TestCache.new
end

Instance Method Details

#delete(key) ⇒ Object



28
29
30
# File 'lib/cache_utils.rb', line 28

def delete(key)
  @@cache_storage.delete(key)
end

#fetch(key) ⇒ Object



20
21
22
# File 'lib/cache_utils.rb', line 20

def fetch(key)
  @@cache_storage[key]
end

#keysObject



32
33
34
# File 'lib/cache_utils.rb', line 32

def keys
  @@cache_storage.keys
end

#write(key, value, options = {}) ⇒ Object



24
25
26
# File 'lib/cache_utils.rb', line 24

def write(key, value, options = {})
  @@cache_storage[key] = value
end