aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache/file_store.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-08-13 20:57:26 -0500
committerJoshua Peek <josh@joshpeek.com>2008-08-13 20:57:26 -0500
commitb8b30985d525fd15b6c16d29fc115e83e3ee5037 (patch)
treea0d4c18494722ce2eb1f1dc6b1c05781f1a6c28d /activesupport/lib/active_support/cache/file_store.rb
parentc7e09a8fb234d80f06fcd70b9263e28e42c4378b (diff)
downloadrails-b8b30985d525fd15b6c16d29fc115e83e3ee5037.tar.gz
rails-b8b30985d525fd15b6c16d29fc115e83e3ee5037.tar.bz2
rails-b8b30985d525fd15b6c16d29fc115e83e3ee5037.zip
Marshal FileStore values
Diffstat (limited to 'activesupport/lib/active_support/cache/file_store.rb')
-rw-r--r--activesupport/lib/active_support/cache/file_store.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb
index 7b6ca39091..437679cc05 100644
--- a/activesupport/lib/active_support/cache/file_store.rb
+++ b/activesupport/lib/active_support/cache/file_store.rb
@@ -9,13 +9,13 @@ module ActiveSupport
def read(name, options = nil)
super
- File.open(real_file_path(name), 'rb') { |f| f.read } rescue nil
+ File.open(real_file_path(name), 'rb') { |f| Marshal.load(f) } rescue nil
end
def write(name, value, options = nil)
super
ensure_cache_path(File.dirname(real_file_path(name)))
- File.atomic_write(real_file_path(name), cache_path) { |f| f.write(value) }
+ File.atomic_write(real_file_path(name), cache_path) { |f| Marshal.dump(value, f) }
rescue => e
RAILS_DEFAULT_LOGGER.error "Couldn't create cache directory: #{name} (#{e.message})" if RAILS_DEFAULT_LOGGER
end