Cache
Disk caching utilities used by compute_magnetic_field_variables to avoid
re-running expensive IRBEM computations when downstream code crashes.
The default cache location is $HOME/.elpaso/joblib_cache. Stale entries
older than 7 days are purged automatically at import el_paso time, and
the entire cache is cleared on graceful interpreter exit via atexit.
el_paso.cache
Functions:
el_paso.cache.cleanup_stale_cache
cleanup_stale_cache
Delete cache entries older than max_age_days from the default cache directory.
This is a no-op if the cache directory does not exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_age_days
|
int
|
Maximum age in days before an entry is removed. |
_MAX_AGE_DAYS
|
Source code in el_paso/cache.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
el_paso.cache.clear_cache
clear_cache
Remove the entire joblib cache directory.
Source code in el_paso/cache.py
78 79 80 81 82 83 84 85 86 87 | |
el_paso.cache.clear_cache_on_success
clear_cache_on_success
Remove the cache directory only if the interpreter is exiting without an unhandled exception.
Intended as an atexit handler so the cache survives crashes but is
cleaned up after a successful run.
Source code in el_paso/cache.py
90 91 92 93 94 95 96 97 98 99 | |
el_paso.cache.get_cache_dir
get_cache_dir
Return the default joblib cache directory at $HOME/.elpaso/joblib_cache.
The directory is created if it does not exist.
Returns:
| Name | Type | Description |
|---|---|---|
Path |
Path
|
The cache directory path. |
Raises:
| Type | Description |
|---|---|
OSError
|
If the |
Source code in el_paso/cache.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |