Class: Wasserstand::HeapCache
- Inherits:
-
Object
- Object
- Wasserstand::HeapCache
- Defined in:
- lib/wasserstand/heap_cache.rb
Instance Method Summary collapse
- #get(name) ⇒ Object
-
#initialize ⇒ HeapCache
constructor
A new instance of HeapCache.
- #set(name, value) ⇒ Object
Constructor Details
#initialize ⇒ HeapCache
Returns a new instance of HeapCache.
3 4 5 |
# File 'lib/wasserstand/heap_cache.rb', line 3 def initialize @backend = {} end |
Instance Method Details
#get(name) ⇒ Object
7 8 9 10 11 |
# File 'lib/wasserstand/heap_cache.rb', line 7 def get(name) result = @backend[name] Wasserstand.logger.debug "#{self.class.name} GET #{result ? 'HIT' : 'MISS'} #{name}" result end |
#set(name, value) ⇒ Object
13 14 15 16 |
# File 'lib/wasserstand/heap_cache.rb', line 13 def set(name, value) Wasserstand.logger.debug "#{self.class.name} SET #{name} => #{value.inspect}" @backend[name] = value end |