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.



10
11
12
# File 'lib/ecb/exchange/memory_cache.rb', line 10

def initialize
  @store = {}
end

Class Method Details

.cacheObject



6
7
8
# File 'lib/ecb/exchange/memory_cache.rb', line 6

def self.cache
  @cache ||= new
end

Instance Method Details

#clearObject



22
23
24
# File 'lib/ecb/exchange/memory_cache.rb', line 22

def clear
  @store.clear
end

#read(key) ⇒ Object



14
15
16
# File 'lib/ecb/exchange/memory_cache.rb', line 14

def read(key)
  @store[key]
end

#write(key, value) ⇒ Object



18
19
20
# File 'lib/ecb/exchange/memory_cache.rb', line 18

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