Class: ECB::Exchange::MemoryCache

Inherits:
Object
  • Object
show all
Defined in:
lib/ecb/exchange/memory_cache.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMemoryCache

Returns a new instance of MemoryCache.


8
9
10
# File 'lib/ecb/exchange/memory_cache.rb', line 8

def initialize
  @store = {}
end

Class Method Details

.cacheObject


4
5
6
# File 'lib/ecb/exchange/memory_cache.rb', line 4

def self.cache
  @cache ||= new
end

Instance Method Details

#clearObject


20
21
22
# File 'lib/ecb/exchange/memory_cache.rb', line 20

def clear
  @store.clear
end

#read(key) ⇒ Object


12
13
14
# File 'lib/ecb/exchange/memory_cache.rb', line 12

def read(key)
  @store[key]
end

#write(key, value) ⇒ Object


16
17
18
# File 'lib/ecb/exchange/memory_cache.rb', line 16

def write(key, value)
  @store[key] = value
end