Sha256: cee01a4178e398d5a31ee0ed47908e34cb3659b117c14aa3b87e4e90fdf047d3
Contents?: true
Size: 521 Bytes
Versions: 5
Compression:
Stored size: 521 Bytes
Contents
class Card::Cache::Temporary attr_reader :store def initialize @store = Hash.new end def read key return unless @store.has_key? key @store[key] end def write key, value @store[key] = value end def fetch key, &block read(key) || write(key, block.call) end def delete key @store.delete key end def dump @store.each do |k, v| p "#{k} --> #{v.inspect[0..30]}" end end def reset @store = {} end def exist? key @store.has_key? key end end
Version data entries
5 entries across 5 versions & 1 rubygems