instance method key_file_path

Ruby on Rails 4.0.13

Since v3.0.20 Last seen in v4.2.9 Private

Available in: v3.0.20 v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9

Signature

key_file_path(key)

Translate a key into a file path.

Parameters

key req
Source
# File activesupport/lib/active_support/cache/file_store.rb, line 130
        def key_file_path(key)
          fname = URI.encode_www_form_component(key)
          hash = Zlib.adler32(fname)
          hash, dir_1 = hash.divmod(0x1000)
          dir_2 = hash.modulo(0x1000)
          fname_paths = []

          # Make sure file name doesn't exceed file system limits.
          begin
            fname_paths << fname[0, FILENAME_MAX_SIZE]
            fname = fname[FILENAME_MAX_SIZE..-1]
          end until fname.blank?

          File.join(cache_path, DIR_FORMATTER % dir_1, DIR_FORMATTER % dir_2, *fname_paths)
        end

Defined in activesupport/lib/active_support/cache/file_store.rb line 130 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::Cache::FileStore

Type at least 2 characters to search.

↑↓ navigate · open · esc close