aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache/strategy
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2017-05-15 08:00:39 -0400
committerGitHub <noreply@github.com>2017-05-15 08:00:39 -0400
commit5bfb2875e9287c75f91e89f5e50654e5fbaa5855 (patch)
treecd25726d1aca26bb5de9cebca7c0728635e9645c /activesupport/lib/active_support/cache/strategy
parentd48008f16438c2c9c9c7295f550568b82b95ef9e (diff)
parentdb9ae5f1e1449b09c08d55a8a3a21ff61d904bd3 (diff)
downloadrails-5bfb2875e9287c75f91e89f5e50654e5fbaa5855.tar.gz
rails-5bfb2875e9287c75f91e89f5e50654e5fbaa5855.tar.bz2
rails-5bfb2875e9287c75f91e89f5e50654e5fbaa5855.zip
Merge pull request #29083 from eugeneius/local_cache_unless_exist
Don't cache locally if unless_exist was passed
Diffstat (limited to 'activesupport/lib/active_support/cache/strategy')
-rw-r--r--activesupport/lib/active_support/cache/strategy/local_cache.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/cache/strategy/local_cache.rb b/activesupport/lib/active_support/cache/strategy/local_cache.rb
index 672eb2bb80..91875a56f5 100644
--- a/activesupport/lib/active_support/cache/strategy/local_cache.rb
+++ b/activesupport/lib/active_support/cache/strategy/local_cache.rb
@@ -115,7 +115,12 @@ module ActiveSupport
end
def write_entry(key, entry, options)
- local_cache.write_entry(key, entry, options) if local_cache
+ if options[:unless_exist]
+ local_cache.delete_entry(key, options) if local_cache
+ else
+ local_cache.write_entry(key, entry, options) if local_cache
+ end
+
super
end