Sha256: 81b967d226d532fe6e82c29cee614c8c7c919d94d490e577959a6d68ef45f68b
Contents?: true
Size: 946 Bytes
Versions: 2
Compression:
Stored size: 946 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) db = uri.path.sub(/^\//, '') db = "0" if db.empty? server = { :host => uri.host, :port => uri.port || "6379", :db => db, :password => uri.password } new server end end class Redis < RedisBase def initialize(server, options = {}) @cache = ::Redis::Factory.create server 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redis-store-1.0.0.beta5 | lib/rack/cache/redis_metastore.rb |
redis-store-1.0.0.beta4 | lib/rack/cache/redis_metastore.rb |