diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-06-30 16:56:41 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-30 16:56:41 +0900 |
commit | d1062732aee590dd0c557dd486356864b32b34f0 (patch) | |
tree | e31bb735e69f2688e581d9da440a1c3e2bda801c /activesupport/lib | |
parent | a9692941600c34afbc8d60d15cb5f179d30f67e5 (diff) | |
parent | 5394be374dd20c34ddf128cfd04d6b80096a4acb (diff) | |
download | rails-d1062732aee590dd0c557dd486356864b32b34f0.tar.gz rails-d1062732aee590dd0c557dd486356864b32b34f0.tar.bz2 rails-d1062732aee590dd0c557dd486356864b32b34f0.zip |
Merge pull request #33264 from huacnlee/fix-redis-incr-ttl-check
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 |