aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache
diff options
context:
space:
mode:
authorgrosser <grosser.michael@gmail.com>2013-08-06 19:43:28 -0700
committergrosser <grosser.michael@gmail.com>2013-08-30 12:53:35 +0200
commitc17bd7476abb0bade3c27e652b1d56548d0ee4ae (patch)
treeb5a15c625f1c713c27857bb5f44d5842a9b9868b /activesupport/lib/active_support/cache
parentf90aa722fad2b33a95c85319070891d1eab352f5 (diff)
downloadrails-c17bd7476abb0bade3c27e652b1d56548d0ee4ae.tar.gz
rails-c17bd7476abb0bade3c27e652b1d56548d0ee4ae.tar.bz2
rails-c17bd7476abb0bade3c27e652b1d56548d0ee4ae.zip
support :unless_exist for FileCache
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 472f23c1c5..d0de6e861a 100644
--- a/activesupport/lib/active_support/cache/file_store.rb
+++ b/activesupport/lib/active_support/cache/file_store.rb
@@ -96,6 +96,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