Sha256: d87c02f8eabd26c8e4b268400d0289546881b4d1eee02362f891d5e5a6727219
Contents?: true
Size: 781 Bytes
Versions: 3
Compression:
Stored size: 781 Bytes
Contents
require 'forwardable' module LockBoxCache class Cache extend Forwardable def_delegators :@cache, :write, :read, :delete class RailsCache def write(key, value) Rails.cache.write(key, value) end def read(key) Rails.cache.read(key) end def delete(key) Rails.cache.delete(key) end end class HashCache def initialize @store = Hash.new end def write(key, value) @store[key] = value end def read(key) @store[key] end def delete(key) @store.delete(key) end end def initialize if defined?(Rails) @cache = RailsCache.new else @cache = HashCache.new end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lockbox_middleware-1.2.2 | lib/lockbox_cache.rb |
lockbox_middleware-1.2.1 | lib/lockbox_cache.rb |
lockbox_middleware-1.2.0 | lib/lockbox_cache.rb |