Sha256: 36f28343ab993112e948c3f4a6563b17a7d9e9c0956db84367f76581ac080804

Contents?: true

Size: 744 Bytes

Versions: 6

Compression:

Stored size: 744 Bytes

Contents

module Waves

  module Caches
    
    #
    # This is just a proxy for the real cache, but adds Waves synchronization
    #
    
    class Synchronized
      
      def initialize( cache ) ; @cache = cache ; end
      def [](key) ; @cache.fetch(key) ; end
      def []=( key, value ) ; @cache.store( key, value ) ; end
      def exists?( key ) ; @cache.has_key?( key ) ; end
      alias :exist? :exists?
      def store( key, val ) ; synchronize { @cache.store( key, value ) }; end
      def fetch( keys ) ; @cache.fetch( key ) ; end
      def delete( key ) ; synchronize { @cache.delete( key ) } ; end
      def clear ; synchronize { @cache.clear } ; end
      def synchronize( &block ) ; Waves.synchronize( &block ) ; end
    end

  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
dyoder-waves-0.8.0 lib/caches/synchronized.rb
waves-edge-2009.03.10.13.14 lib/caches/synchronized.rb
waves-stable-2009.3.10 lib/caches/synchronized.rb
waves-0.8.0 lib/caches/synchronized.rb
waves-0.8.2 lib/caches/synchronized.rb
waves-0.8.1 lib/caches/synchronized.rb