Sha256: b222c049b20c28befe555b7ca198b1d33b5f21520c5099e962c9c5f27ac4ed07
Contents?: true
Size: 841 Bytes
Versions: 5
Compression:
Stored size: 841 Bytes
Contents
module CrossStub module Stores class Redis < Base def initialize(connection_and_cache_id, truncate = true) require 'redis' connection, @cache_id = connection_and_cache_id.split('/') host, port = connection.split(':') @redis = ::Redis.new(:host => host, :port => port.to_i) super(truncate) end def current @cache_id end def previous "#{@cache_id}.stale" end private def exists?(cache_id) not @redis[cache_id].nil? end def dump(cache_id, data) @redis[cache_id] = Marshal.dump(data) end def load(cache_id) (data = @redis[cache_id] ) ? Marshal.load(data) : {} end def delete(cache_id) @redis.del(cache_id) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems