mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Padding expires_in by 5 minutes on dalli key write to facilitate :race_condition_ttl working correctly.
This commit is contained in:
parent
888a7a5bdc
commit
13d8777b63
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue