Class: ActionController::Caching::Fragments::UnthreadedFileStore
- Defined in:
- lib/action_controller/caching.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cache_path ⇒ Object
readonly
Returns the value of attribute cache_path.
Instance Method Summary collapse
-
#delete(name, options) ⇒ Object
:nodoc:.
-
#delete_matched(matcher, options) ⇒ Object
:nodoc:.
-
#initialize(cache_path) ⇒ UnthreadedFileStore
constructor
A new instance of UnthreadedFileStore.
-
#read(name, options = nil) ⇒ Object
:nodoc:.
-
#write(name, value, options = nil) ⇒ Object
:nodoc:.
Constructor Details
#initialize(cache_path) ⇒ UnthreadedFileStore
Returns a new instance of UnthreadedFileStore.
516 517 518 |
# File 'lib/action_controller/caching.rb', line 516 def initialize(cache_path) @cache_path = cache_path end |
Instance Attribute Details
#cache_path ⇒ Object (readonly)
Returns the value of attribute cache_path.
514 515 516 |
# File 'lib/action_controller/caching.rb', line 514 def cache_path @cache_path end |
Instance Method Details
#delete(name, options) ⇒ Object
:nodoc:
531 532 533 534 535 |
# File 'lib/action_controller/caching.rb', line 531 def delete(name, ) #:nodoc: File.delete(real_file_path(name)) rescue SystemCallError => e # If there's no cache, then there's nothing to complain about end |
#delete_matched(matcher, options) ⇒ Object
:nodoc:
537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/action_controller/caching.rb', line 537 def delete_matched(matcher, ) #:nodoc: search_dir(@cache_path) do |f| if f =~ matcher begin File.delete(f) rescue SystemCallError => e # If there's no cache, then there's nothing to complain about end end end end |
#read(name, options = nil) ⇒ Object
:nodoc:
527 528 529 |
# File 'lib/action_controller/caching.rb', line 527 def read(name, = nil) #:nodoc: File.open(real_file_path(name), 'rb') { |f| f.read } rescue nil end |
#write(name, value, options = nil) ⇒ Object
:nodoc:
520 521 522 523 524 525 |
# File 'lib/action_controller/caching.rb', line 520 def write(name, value, = nil) #:nodoc: ensure_cache_path(File.dirname(real_file_path(name))) File.open(real_file_path(name), "wb+") { |f| f.write(value) } rescue => e Base.logger.error "Couldn't create cache directory: #{name} (#{e.})" if Base.logger end |