Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Padding expires_in by 5 minutes on dalli key write to facilitate :rac…

…e_condition_ttl working correctly.
  • Loading branch information...
commit 13d8777b63f93426f6a1101f066cc3cf218109d3 1 parent 888a7a5
@mje113 authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 activesupport/lib/active_support/cache/mem_cache_store.rb
View
4 activesupport/lib/active_support/cache/mem_cache_store.rb
@@ -132,6 +132,10 @@ def write_entry(key, entry, options) # :nodoc:
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
Please sign in to comment.
Something went wrong with that request. Please try again.