Class: Waves::Caches::Synchronized
Overview
This is just a proxy for the real cache, but adds Waves synchronization
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Synchronized.
12
|
# File 'lib/caches/synchronized.rb', line 12
def initialize( cache ) ; @cache = cache ; end
|
Instance Method Details
13
|
# File 'lib/caches/synchronized.rb', line 13
def [](key) ; @cache.fetch(key) ; end
|
#[]=(key, value) ⇒ Object
14
|
# File 'lib/caches/synchronized.rb', line 14
def []=( key, value ) ; @cache.store( key, value ) ; end
|
20
|
# File 'lib/caches/synchronized.rb', line 20
def clear ; synchronize { @cache.clear } ; end
|
#delete(key) ⇒ Object
19
|
# File 'lib/caches/synchronized.rb', line 19
def delete( key ) ; synchronize { @cache.delete( key ) } ; end
|
#exists?(key) ⇒ Boolean
Also known as:
exist?
15
|
# File 'lib/caches/synchronized.rb', line 15
def exists?( key ) ; @cache.has_key?( key ) ; end
|
#fetch(keys) ⇒ Object
18
|
# File 'lib/caches/synchronized.rb', line 18
def fetch( keys ) ; @cache.fetch( key ) ; end
|
#store(key, val) ⇒ Object
17
|
# File 'lib/caches/synchronized.rb', line 17
def store( key, val ) ; synchronize { @cache.store( key, value ) }; end
|
#synchronize(&block) ⇒ Object
21
|
# File 'lib/caches/synchronized.rb', line 21
def synchronize( &block ) ; Waves.synchronize( &block ) ; end
|