Sha256: 60a61894551c21e0e0289840ebe60fda3cbf796f2505ed0ab8a4f99b2039754c
Contents?: true
Size: 752 Bytes
Versions: 1
Compression:
Stored size: 752 Bytes
Contents
module Rails class Cache def initialize @cache = {} end def fetch(e) if @cache.key?(e) return read(e) else a = yield write(e,a) return a end end def clear @cache.clear end def write(a,b) @cache[a] = b end def delete(a) @cache.delete(a) end def read(a) @cache[a] end def read_multi(*keys) keys.reduce({}) do |hash, key| hash[key] = @cache[key] hash end end end def self.cache @@cache ||= Cache.new end class Logger def info(string) end def debug(string) end def error(string) end end def self.logger @logger = Logger.new end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
identity_cache-0.0.1 | test/helpers/cache.rb |