Class: ECB::Exchange::MemoryCache
- Inherits:
-
Object
- Object
- ECB::Exchange::MemoryCache
- Defined in:
- lib/ecb/exchange/memory_cache.rb
Class Method Summary collapse
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize ⇒ MemoryCache
constructor
A new instance of MemoryCache.
- #read(key) ⇒ Object
- #write(key, value) ⇒ Object
Constructor Details
#initialize ⇒ MemoryCache
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
.cache ⇒ Object
6 7 8 |
# File 'lib/ecb/exchange/memory_cache.rb', line 6 def self.cache @cache ||= new end |
Instance Method Details
#clear ⇒ Object
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 |