craft_parts.sources.cache module
Cache base and file cache.
-
class craft_parts.sources.cache.FileCache(cache_dir, *, namespace='files')
Bases: object
Cache files based on the supplied key.
- Parameters:
-
-
cache(*, filename, key)
Cache a file revision with hash in XDG cache, unless it already exists.
- Parameters:
-
- Return type:
Path | None
- Returns:
The path to the cached file, or None if the file was not cached.
-
clean()
Remove all files from the cache namespace.
- Return type:
None
-
get(*, key)
Get the filepath which matches the hash calculated with algorithm.
- Parameters:
key (str) – The key used to cache the file.
- Return type:
Path | None
- Returns:
The path to cached file, or None if the file is not cached.