Sha256: 1420a6d3528a59e1b08ed2de0f1063f9fae6da43f594c979b902b85835e94bce

Contents?: true

Size: 474 Bytes

Versions: 9

Compression:

Stored size: 474 Bytes

Contents

module RProxy
  class CachePool

    def initialize
      @pool = {}
      @able_write = true
    end

    def []=(key, value)
      return value if !@able_write
      @pool[key] = value
    end


    def [](key)
      @pool[key]
    end

    def writable?
      @able_write
    end

    def disable_write!
      @able_write = false
    end

    def enable_write!
      @able_write = true
    end

    def flush
      tmp = @pool
      @pool = {}
      tmp
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
r_proxy-0.2.8 lib/r_proxy/cache_pool.rb
r_proxy-0.2.7 lib/r_proxy/cache_pool.rb
r_proxy-0.2.6 lib/r_proxy/cache_pool.rb
r_proxy-0.2.5 lib/r_proxy/cache_pool.rb
r_proxy-0.2.4 lib/r_proxy/cache_pool.rb
r_proxy-0.2.3 lib/r_proxy/cache_pool.rb
r_proxy-0.2.2 lib/r_proxy/cache_pool.rb
r_proxy-0.2.1 lib/r_proxy/cache_pool.rb
r_proxy-0.2.0 lib/r_proxy/cache_pool.rb