Sha256: 17947dc45295f18d77f0a771449acd09edf386baa1e2327ec7628694c0859b7c
Contents?: true
Size: 702 Bytes
Versions: 6
Compression:
Stored size: 702 Bytes
Contents
module Waves module Caches # # This class is more or less here to establish the basic interface for caching and for # lightweight caching that doesn't require a dedicated caching process. # class Simple def initialize( hash = {} ) ; @cache = hash ; end def [](key) ; fetch(key) ; end def []=( key, value ) ; store( key, value ) ; end def exists?( key ) ; fetch(key) == nil ? false : true ; end alias :exist? :exists? def store( key, val ) ; @cache[ key ] = val ; end def fetch( key ) ; @cache[ key ] ; end def delete( key ) ; @cache.delete( key ) ; end def clear ; @cache = {} ; end end end end
Version data entries
6 entries across 6 versions & 4 rubygems