diff options
author | Jason Lee <huacnlee@gmail.com> | 2018-06-30 12:52:29 +0800 |
---|---|---|
committer | Jason Lee <huacnlee@gmail.com> | 2018-06-30 12:52:29 +0800 |
commit | 5394be374dd20c34ddf128cfd04d6b80096a4acb (patch) | |
tree | e31bb735e69f2688e581d9da440a1c3e2bda801c /activesupport/lib | |
parent | a9692941600c34afbc8d60d15cb5f179d30f67e5 (diff) | |
download | rails-5394be374dd20c34ddf128cfd04d6b80096a4acb.tar.gz rails-5394be374dd20c34ddf128cfd04d6b80096a4acb.tar.bz2 rails-5394be374dd20c34ddf128cfd04d6b80096a4acb.zip |
Fix Cache :redis_store increment/decrement ttl check and add more tests.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/cache/redis_cache_store.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/cache/redis_cache_store.rb b/activesupport/lib/active_support/cache/redis_cache_store.rb index 95f8f639e8..a05718b663 100644 --- a/activesupport/lib/active_support/cache/redis_cache_store.rb +++ b/activesupport/lib/active_support/cache/redis_cache_store.rb @@ -264,7 +264,7 @@ module ActiveSupport failsafe :increment do redis.with do |c| val = c.incrby key, amount - if expires_in > 0 && c.ttl(key) == -2 + if expires_in > 0 && c.ttl(key) < 0 c.expire key, expires_in end val @@ -290,7 +290,7 @@ module ActiveSupport failsafe :decrement do redis.with do |c| val = c.decrby key, amount - if expires_in > 0 && c.ttl(key) == -2 + if expires_in > 0 && c.ttl(key) < 0 c.expire key, expires_in end val |