lib/stores/cachetastic_stores_memcache.rb in cachetastic-1.1.3 vs lib/stores/cachetastic_stores_memcache.rb in cachetastic-1.1.8

- old
+ new

@@ -1,5 +1,24 @@ +# This store uses Memcache as it's backing. +# The configuration for this should look something like this: +# my_awesome_cache_options: +# debug: false +# store: memcache +# marshall_method: none +# default_expiry: <%= 24.hours %> +# store_options: +# c_threshold: 10_000 +# compression: true +# debug: false +# readonly: false +# urlencode: false +# logging: +# logger_1: +# type: file +# file: log/memcached.log +# servers: +# - 127.0.0.1:11211 class Cachetastic::Stores::Memcache < Cachetastic::Stores::Base def setup self.conn = MemCache.new(self.servers, self.store_options.merge({:namespace => self.namespace})) self.version = self.get_version(self.name) @@ -23,15 +42,10 @@ def inspect self.conn.inspect + " <version: #{self.version}> #{self.conn.stats.inspect}" end - def namespace - v = self.get_version(self.name) - return "#{name}.#{v}" - end - def valid? begin return (self.conn.active? && self.version == self.get_version(self.name)) rescue Exception => e puts e.message @@ -41,9 +55,14 @@ end protected attr_accessor :conn attr_accessor :version + + def namespace + v = self.get_version(self.name) + return "#{name}.#{v}" + end def ns_versions ivar_cache do ns_conn = MemCache.new(self.servers, self.store_options.merge({:namespace => :namespace_versions})) end \ No newline at end of file