Class: ActiveSupport::Cache::FileStore
- Inherits:
-
Store
- Object
- Store
- ActiveSupport::Cache::FileStore
- Defined in:
- lib/cache_fix.rb
Instance Attribute Summary collapse
-
#cache_path ⇒ Object
readonly
Returns the value of attribute cache_path.
Instance Method Summary collapse
Instance Attribute Details
#cache_path ⇒ Object (readonly)
Returns the value of attribute cache_path.
8 9 10 |
# File 'lib/cache_fix.rb', line 8 def cache_path @cache_path end |
Instance Method Details
#read(name, options = nil) ⇒ Object
10 11 12 13 |
# File 'lib/cache_fix.rb', line 10 def read(name, = nil) super File.open(real_file_path(name), 'rb') { |f| Marshal.load(f) } rescue nil end |
#write(name, value, options = nil) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/cache_fix.rb', line 15 def write(name, value, = nil) super ensure_cache_path(File.dirname(real_file_path(name))) File.atomic_write(real_file_path(name), cache_path) { |f| Marshal.dump(value, f) } rescue => e logger.error "Couldn't create cache directory: #{name} (#{e.})" if logger end |