Sha256: 8bbd98baf96aeadaff9f5111dbc489fb66bf978be35becfc5362122c172d0276
Contents?: true
Size: 1.55 KB
Versions: 6
Compression:
Stored size: 1.55 KB
Contents
module Picky module Backends class Redis # Redis Backend Accessor. # # Provides necessary helper methods for its # subclasses. # Not directly useable, as it does not provide # dump/load methods. # class Basic attr_reader :client, :namespace # An index cache takes a path, without file extension, # which will be provided by the subclasses. # def initialize client, namespace, options = {} @client = client @namespace = namespace @empty = options[:empty] @initial = options[:initial] @realtime = options[:realtime] end # The empty index that is used for putting the index # together. # def empty @empty && @empty.clone || (@realtime ? self.reset : {}) end # The initial content before loading. # # Note: As Redis indexes needn't be loaded per se, # this just returns the same thing as #load. # def initial @initial && @initial.clone || (@realtime ? self.reset : {}) end # Returns itself. # def load self end # We do not use Redis to retrieve data. # def retrieve # Nothing. end # Clears the whole namespace. # def reset clear self end # # def to_s "#{self.class}(#{namespace}:*)" end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems