Class: Tochtli::Test::MemoryCache

Inherits:
Object
  • Object
show all
Defined in:
lib/tochtli/test/memory_cache.rb

Overview

a simple proxy to replicate ActiveSupport cache interface using mini store

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMemoryCache

Returns a new instance of MemoryCache.



9
10
11
# File 'lib/tochtli/test/memory_cache.rb', line 9

def initialize
  @store = MiniCache::Store.new
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



7
8
9
# File 'lib/tochtli/test/memory_cache.rb', line 7

def store
  @store
end

Instance Method Details

#read(name) ⇒ Object



17
18
19
# File 'lib/tochtli/test/memory_cache.rb', line 17

def read(name)
  store.get(name)
end

#write(name, value) ⇒ Object



13
14
15
# File 'lib/tochtli/test/memory_cache.rb', line 13

def write(name, value)
  store.set(name, value)
end