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)
| 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 | """ |