key_file_path(key)
private
Translate a key into a file path.
# File activesupport/lib/active_support/cache/file_store.rb, line 138
def key_file_path(key)
fname = Rack::Utils.escape(key)
hash = Zlib.adler32(fname)
hash, dir_1 = hash.divmod(0x1000)
dir_2 = hash.modulo(0x1000)
fname_paths = []
# Make sure file name is < 255 characters so it doesn't exceed file system limits.
if fname.size <= 255
fname_paths << fname
else
while fname.size <= 255
fname_path << fname[0, 255]
fname = fname[255, -1]
end
end
File.join(cache_path, DIR_FORMATTER % dir_1, DIR_FORMATTER % dir_2, *fname_paths)
end