Sha256: 8499c8d82d6855bcd404e9485f998f657c890d215ed2deb72de2576d88497684
Contents?: true
Size: 942 Bytes
Versions: 7
Compression:
Stored size: 942 Bytes
Contents
module Rack module Cache class MetaStore class RedisBase < MetaStore extend Rack::Utils # The ::MarshaledRedis object used to communicate with the Redis daemon. attr_reader :cache def self.resolve(uri) db = uri.path.sub(/^\//, '') db = "0" if db.empty? server = { :host => uri.host, :port => uri.port || "6379", :db => db } new server end end class Redis < RedisBase def initialize(server, options = {}) @cache = ::MarshaledRedis.new server end def read(key) key = hexdigest(key) cache.marshalled_get(key) || [] end def write(key, entries) key = hexdigest(key) cache.marshalled_set(key, entries) end def purge(key) cache.del(hexdigest(key)) nil end end REDIS = Redis end end end
Version data entries
7 entries across 7 versions & 1 rubygems