Sha256: f58c81ca675205600aadf7389df7e4140fdfde051deb1e0a1e845ad9484e7eb9
Contents?: true
Size: 1.55 KB
Versions: 10
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] @immediate = options[:immediate] end # The empty index that is used for putting the index # together. # def empty @empty && @empty.clone || (@immediate ? 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 || (@immediate ? 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
10 entries across 10 versions & 1 rubygems