diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-08-06 14:52:39 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-08-06 14:54:18 -0500 |
commit | dfc83566b3f52b4b84db52312c01fcc3b8847059 (patch) | |
tree | a5198e7a301867c71ead91f6241710fa4b417908 /activesupport/lib | |
parent | e5b1ab7cc39ff57f9789ffda75fb33f72187775d (diff) | |
download | rails-dfc83566b3f52b4b84db52312c01fcc3b8847059.tar.gz rails-dfc83566b3f52b4b84db52312c01fcc3b8847059.tar.bz2 rails-dfc83566b3f52b4b84db52312c01fcc3b8847059.zip |
Make FileStore use atomic writes
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/cache/file_store.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb index 5b771b1da0..0bdca49388 100644 --- a/activesupport/lib/active_support/cache/file_store.rb +++ b/activesupport/lib/active_support/cache/file_store.rb @@ -15,7 +15,7 @@ module ActiveSupport def write(name, value, options = nil) super ensure_cache_path(File.dirname(real_file_path(name))) - File.open(real_file_path(name), "wb+") { |f| f.write(value) } + File.atomic_write(real_file_path(name)) { |f| f.write(value) } rescue => e RAILS_DEFAULT_LOGGER.error "Couldn't create cache directory: #{name} (#{e.message})" if RAILS_DEFAULT_LOGGER end |