Class: ActionController::Caching::Fragments::FileStore
- Defined in:
- lib/action_controller/caching.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#delete(name, options) ⇒ Object
:nodoc:.
-
#delete_matched(matcher, options) ⇒ Object
:nodoc:.
-
#initialize(cache_path) ⇒ FileStore
constructor
A new instance of FileStore.
-
#read(name, options = {}) ⇒ Object
:nodoc:.
-
#write(name, value, options = {}) ⇒ Object
:nodoc:.
Constructor Details
#initialize(cache_path) ⇒ FileStore
Returns a new instance of FileStore.
357 358 359 |
# File 'lib/action_controller/caching.rb', line 357 def initialize(cache_path) @cache_path = cache_path end |
Instance Method Details
#delete(name, options) ⇒ Object
:nodoc:
372 373 374 375 376 |
# File 'lib/action_controller/caching.rb', line 372 def delete(name, ) #:nodoc: File.delete(real_file_path(name)) rescue SystemCallError => e Base.logger.info "Couldn't expire cache #{name} (#{e.})" unless Base.logger.nil? end |
#delete_matched(matcher, options) ⇒ Object
:nodoc:
378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/action_controller/caching.rb', line 378 def delete_matched(matcher, ) #:nodoc: search_dir(@cache_path) do |f| if f =~ matcher begin File.delete(f) rescue Object => e Base.logger.info "Couldn't expire cache: #{f} (#{e.})" unless Base.logger.nil? end end end end |
#read(name, options = {}) ⇒ Object
:nodoc:
368 369 370 |
# File 'lib/action_controller/caching.rb', line 368 def read(name, = {}) #:nodoc: IO.read(real_file_path(name)) rescue nil end |
#write(name, value, options = {}) ⇒ Object
:nodoc:
361 362 363 364 365 366 |
# File 'lib/action_controller/caching.rb', line 361 def write(name, value, = {}) #:nodoc: ensure_cache_path(File.dirname(real_file_path(name))) File.open(real_file_path(name), "w+") { |f| f.write(value) } rescue => e Base.logger.info "Couldn't create cache directory: #{name} (#{e.})" unless Base.logger.nil? end |