instance method
key_file_path
Ruby on Rails 4.0.13
Since v3.0.20 Last seen in v4.2.9 PrivateSignature
key_file_path(key)
Translate a key into a file path.
Parameters
-
keyreq
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