aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-10-12 09:50:24 -0700
committerXavier Noria <fxn@hashref.com>2012-10-12 09:50:24 -0700
commit168df24ac87c2f8a07b05489140bf337ddab440a (patch)
treef1c0548ffea32978493e5334764102de4b994d35 /activesupport
parent1957687ca437a65f851db1e9c3202bd59f71ac29 (diff)
parent13d8777b63f93426f6a1101f066cc3cf218109d3 (diff)
downloadrails-168df24ac87c2f8a07b05489140bf337ddab440a.tar.gz
rails-168df24ac87c2f8a07b05489140bf337ddab440a.tar.bz2
rails-168df24ac87c2f8a07b05489140bf337ddab440a.zip
Merge pull request #7913 from mje113/master
MemCacheStore's move to dalli as a backend broke :race_condition_ttl support
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/cache/mem_cache_store.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb
index 5aa78cc9f3..17450fe4d0 100644
--- a/activesupport/lib/active_support/cache/mem_cache_store.rb
+++ b/activesupport/lib/active_support/cache/mem_cache_store.rb
@@ -132,6 +132,10 @@ module ActiveSupport
method = options && options[:unless_exist] ? :add : :set
value = options[:raw] ? entry.value.to_s : entry
expires_in = options[:expires_in].to_i
+ if expires_in > 0 && !options[:raw]
+ # Set the memcache expire a few minutes in the future to support race condition ttls on read
+ expires_in += 5.minutes
+ end
@data.send(method, escape_key(key), value, expires_in, options)
rescue Dalli::DalliError => e
logger.error("DalliError (#{e}): #{e.message}") if logger