Sha256: cf0d6509c1246b7b3bc52ef8db8dc188d54346d4bdcaeafd9ee18476abb07f0f
Contents?: true
Size: 864 Bytes
Versions: 3
Compression:
Stored size: 864 Bytes
Contents
module Rack module Cache class MetaStore class RedisBase < MetaStore extend Rack::Utils # The Redis::Store object used to communicate with the Redis daemon. attr_reader :cache def self.resolve(uri) new ::Redis::Factory.convert_to_redis_client_options(uri.to_s) end end class Redis < RedisBase def initialize(server, options = {}) options[:redis_server] ||= server @cache = ::Redis::Factory.create options end def read(key) key = hexdigest(key) cache.get(key) || [] end def write(key, entries) key = hexdigest(key) cache.set(key, entries) end def purge(key) cache.del(hexdigest(key)) nil end end REDIS = Redis end end end
Version data entries
3 entries across 3 versions & 2 rubygems