Sha256: 3288e6417adcb80a3d21fc32b3e00f032ec74f7b7d6b346f873fb1f857b37ddd
Contents?: true
Size: 1.63 KB
Versions: 7
Compression:
Stored size: 1.63 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] end # The empty index that is used for putting the index # together. # def empty @empty && @empty.clone || {} 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 || self end # Returns itself. # def load self end # We do not use Redis to retrieve data. # def retrieve # Nothing. end # Deletes the Redis index namespace. # def delete # Not implemented here. # Note: backend.flushdb might be the way to go, # but since we cannot delete by key pattern, # we don't do anything. end # # def to_s "#{self.class}(#{namespace}:*)" end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems