Class: Wasserstand::HeapCache
- Inherits:
-
Object
- Object
- Wasserstand::HeapCache
- Defined in:
- lib/wasserstand/heap_cache.rb
Overview
Cache objects in memory
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.
6 7 8 |
# File 'lib/wasserstand/heap_cache.rb', line 6 def initialize @backend = {} end |
Instance Method Details
#get(name) ⇒ Object
10 11 12 13 14 |
# File 'lib/wasserstand/heap_cache.rb', line 10 def get(name) result = @backend[name] Wasserstand.logger.debug "#{self.class.name} GET #{result ? 'HIT' : 'MISS'} #{name}" result end |
#set(name, value) ⇒ Object
16 17 18 19 |
# File 'lib/wasserstand/heap_cache.rb', line 16 def set(name, value) Wasserstand.logger.debug "#{self.class.name} SET #{name} => #{value.inspect}" @backend[name] = value end |