0
@@ -24,7 +24,7 @@ class Merb::Cache::MemcacheStore
0
namespace = @config[:namespace] || 'merb-cache'
0
host = @config[:host] || '127.0.0.1:11211'
0
@memcache = MemCache.new(host, {:namespace => namespace})
0
- @tracking_key = "_#{namespace}_keys" unless @config[:no_tracking]
0
+ @tracking_key = "_#{namespace}_keys" unless @config[:no_tracking]
== true0
raise NotReady unless @memcache.active?
0
@@ -39,7 +39,7 @@ class Merb::Cache::MemcacheStore
0
# true if the cache entry exists, false otherwise
0
- not
@memcache.get(key).nil?
0
+ not
cache_get(key).nil?
0
# Capture or restore the data in cache.
0
@@ -62,11 +62,10 @@ class Merb::Cache::MemcacheStore
0
# It uses the capture_#{engine} and concat_#{engine} methods to do so.
0
# The captured data are then marshalled and stored.
0
def cache(_controller, key, from_now = nil, &block)
0
- _data =
@memcache.get(key)
0
+ _data =
cache_get(key)
0
- _expire = from_now ? from_now.minutes.from_now.to_i : 0
0
_data = _controller.send(:capture, &block)
0
-
@memcache.set(key, _data, _expire)
0
+
cache_set(key, _data, from_now)
0
_controller.send(:concat, _data, block.binding)
0
@@ -83,7 +82,7 @@ class Merb::Cache::MemcacheStore
0
_expire = from_now ? from_now.minutes.from_now.to_i : 0
0
@memcache.set(key, data, _expire)
0
cache_start_tracking(key)
0
- Merb.logger.info
("cache: set (#{key})")
0
+ Merb.logger.info
!("cache: set (#{key})")
0
@@ -98,7 +97,7 @@ class Merb::Cache::MemcacheStore
0
# nil is returned whether the entry expired or was not found
0
data = @memcache.get(key)
0
- Merb.logger.info
("cache: #{data.nil? ? "miss" : "hit"} (#{key})")
0
+ Merb.logger.info
!("cache: #{data.nil? ? "miss" : "hit"} (#{key})")
0
@@ -109,7 +108,7 @@ class Merb::Cache::MemcacheStore
0
cache_stop_tracking(key)
0
- Merb.logger.info
("cache: expired (#{key})")
0
+ Merb.logger.info
!("cache: expired (#{key})")
0
@@ -122,12 +121,10 @@ class Merb::Cache::MemcacheStore
0
# In memcache this requires to keep track of all keys (on by default).
0
# If you don't need this, set :no_tracking => true in the config.
0
+ Merb.logger.debug!("cache: attempting to expire #{key}")
0
for _key in get_tracked_keys
0
- Merb.logger.info("cache: expired #{_key}")
0
+ expire(_key) if /#{key}/ =~ _key
0
Merb.logger.info("cache: expire_match is not supported with memcache (set :no_tracking => false in your config")
Comments
No one has commented yet.