craft_parts.sources.cache module¶
Cache base and file cache.
- class craft_parts.sources.cache.FileCache(cache_dir, *, namespace='files')[source]¶
Bases:
object
Cache files based on the supplied key.
- Parameters:
cache_dir (
Path
)namespace (
str
)
- cache(*, filename, key)[source]¶
Cache a file revision with hash in XDG cache, unless it already exists.
- Parameters:
filename (
str
) – The path to the file to cache.key (
str
) – The key to cache the file under.
- Return type:
Path
|None
- Returns:
The path to the cached file, or None if the file was not cached.