Class ActiveSupport::Cache::FileStore
In: vendor/rails/activesupport/lib/active_support/cache/file_store.rb
Parent: Store

Methods

delete   delete_matched   exist?   new   read   write  

Attributes

cache_path  [R] 

Public Class methods

[Source]

   # File vendor/rails/activesupport/lib/active_support/cache/file_store.rb, line 6
6:       def initialize(cache_path)
7:         @cache_path = cache_path
8:       end

Public Instance methods

[Source]

    # File vendor/rails/activesupport/lib/active_support/cache/file_store.rb, line 23
23:       def delete(name, options = nil)
24:         super
25:         File.delete(real_file_path(name))
26:       rescue SystemCallError => e
27:         # If there's no cache, then there's nothing to complain about
28:       end

[Source]

    # File vendor/rails/activesupport/lib/active_support/cache/file_store.rb, line 30
30:       def delete_matched(matcher, options = nil)
31:         super
32:         search_dir(@cache_path) do |f|
33:           if f =~ matcher
34:             begin
35:               File.delete(f)
36:             rescue SystemCallError => e
37:               # If there's no cache, then there's nothing to complain about
38:             end
39:           end
40:         end
41:       end

[Source]

    # File vendor/rails/activesupport/lib/active_support/cache/file_store.rb, line 43
43:       def exist?(name, options = nil)
44:         super
45:         File.exist?(real_file_path(name))
46:       end

[Source]

    # File vendor/rails/activesupport/lib/active_support/cache/file_store.rb, line 10
10:       def read(name, options = nil)
11:         super
12:         File.open(real_file_path(name), 'rb') { |f| f.read } rescue nil
13:       end

[Source]

    # File vendor/rails/activesupport/lib/active_support/cache/file_store.rb, line 15
15:       def write(name, value, options = nil)
16:         super
17:         ensure_cache_path(File.dirname(real_file_path(name)))
18:         File.open(real_file_path(name), "wb+") { |f| f.write(value) }
19:       rescue => e
20:         RAILS_DEFAULT_LOGGER.error "Couldn't create cache directory: #{name} (#{e.message})" if RAILS_DEFAULT_LOGGER
21:       end

[Validate]