1
0
Fork 0
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:
Mike Evans 2012-10-11 15:46:30 -04:00
parent 888a7a5bdc
commit 13d8777b63

View file

@ -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