DiskCacher
- class coba.context.DiskCacher
A cacher that writes to disk.
The DiskCacher compresses all values before writing to conserve disk space.
Constructors
- __init__(cache_dir: str | Path) None
Instantiate a DiskCacher.
- Parameters:
cache_dir – The directory path where all given keys will be cached as files
Methods
- get_set(key: str, getter: Callable[[], Iterable[str]] | Iterable[str]) ContextManager[Iterable[str]]
Get a key from the cache.
If the key is not in the cache put it first using getter.
- Parameters:
key – The key to get from the cache.
getter – A method for getting the value if necessary.
- rmv(key: str) None
Remove a key from the cache.
- Parameters:
key – The key to remove from the cache.
Attributes
- cache_directory
The directory where the cache will write to disk.