lair.config.get_cache_dir#
- lair.config.get_cache_dir()[source]#
Resolve the cache directory.
The environment variable
LAIR_CACHE_DIRis read each time this is called, not when lair is imported, so setting it afterimport lairworks. The folder is not made here: the code that caches makes it the first time it writes there, soimport lairworks where the home directory is read-only.- Returns:
Path –
$LAIR_CACHE_DIR, or.cache/lairin the home directory when the variable is unset or empty.- Return type:
See also
get_data_dirThe folder of a data archive, which has no default.
lair.records.CacherWrites the cache files.
Examples
>>> import os >>> from lair.config import get_cache_dir >>> os.environ["LAIR_CACHE_DIR"] = "/scratch/lair_cache" >>> get_cache_dir().as_posix() '/scratch/lair_cache' >>> del os.environ["LAIR_CACHE_DIR"] >>> get_cache_dir().parts[-2:] ('.cache', 'lair')