Sha256: 5dce311a61edcfef24e78e1c87ac133140ee81d43401a3eff4052597e2db6bf5

Contents?: true

Size: 348 Bytes

Versions: 3

Compression:

Stored size: 348 Bytes

Contents

module Pakyow
  class Cache
    def initialize
      @store = {}
    end

    def put(key, v)
      @store[key] = v
    end

    def get(key, &block)
      v = @store[key]
      if v == nil && block_given?
        v = block.call(key)
        @store[key] = v
      end
      v
    end

    def invalidate(key)
      put(key, nil)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pakyow-core-0.8rc1 pakyow-core/lib/core/cache.rb
pakyow-core-0.7.2 pakyow-core/lib/core/cache.rb
pakyow-core-0.7.1 pakyow-core/lib/core/cache.rb