MCPcopy
hub / github.com/django/django / _key_to_file

Method _key_to_file

django/core/cache/backends/filebased.py:124–138  ·  view source on GitHub ↗

Convert a key into a cache file path. Basically this is the root cache path joined with the md5sum of the key and a suffix.

(self, key, version=None)

Source from the content-addressed store, hash-verified

122 safe_makedirs(self._dir, mode=0o700, exist_ok=True)
123
124 def _key_to_file(self, key, version=None):
125 """
126 Convert a key into a cache file path. Basically this is the
127 root cache path joined with the md5sum of the key and a suffix.
128 """
129 key = self.make_and_validate_key(key, version=version)
130 return os.path.join(
131 self._dir,
132 "".join(
133 [
134 md5(key.encode(), usedforsecurity=False).hexdigest(),
135 self.cache_suffix,
136 ]
137 ),
138 )
139
140 def clear(self):
141 """

Callers 5

getMethod · 0.95
setMethod · 0.95
touchMethod · 0.95
deleteMethod · 0.95
has_keyMethod · 0.95

Calls 3

make_and_validate_keyMethod · 0.80
joinMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected