aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-10-28 19:09:22 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-10-28 19:09:22 -0200
commitf18cf8e4884529f28d19f118abd0b46c99bd8cfa (patch)
treeda0bdb7f4888b51cac17e3d31029c71ff52b5797 /activesupport/lib/active_support/cache
parentf78c5fbb96b507fb80405c25cfce12136f9d45cd (diff)
parentc17bd7476abb0bade3c27e652b1d56548d0ee4ae (diff)
downloadrails-f18cf8e4884529f28d19f118abd0b46c99bd8cfa.tar.gz
rails-f18cf8e4884529f28d19f118abd0b46c99bd8cfa.tar.bz2
rails-f18cf8e4884529f28d19f118abd0b46c99bd8cfa.zip
Merge pull request #11785 from grosser/grosser/file-unless-exist
support :unless_exist for FileCache Conflicts: activesupport/CHANGELOG.md activesupport/test/caching_test.rb
Diffstat (limited to 'activesupport/lib/active_support/cache')
-rw-r--r--activesupport/lib/active_support/cache/file_store.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb
index 10d39463ec..5cd6065077 100644
--- a/activesupport/lib/active_support/cache/file_store.rb
+++ b/activesupport/lib/active_support/cache/file_store.rb
@@ -97,6 +97,7 @@ module ActiveSupport
def write_entry(key, entry, options)
file_name = key_file_path(key)
+ return false if options[:unless_exist] && File.exist?(file_name)
ensure_cache_path(File.dirname(file_name))
File.atomic_write(file_name, cache_path) {|f| Marshal.dump(entry, f)}
true