earthkit.geo.utils.caching.cache_file¶
- earthkit.geo.utils.caching.cache_file(owner, create, args, hash_extra=None, extension='.cache', force=None, replace=None)¶
Create a cache or temporary file in the folder specified by the cache-policy.
- Parameters:
owner (
str) – The owner of the cache file is generally the name of the source that calledcache_file().create (
callable) – The method to create the contents of the cache file.args (
list-like) – The parameters used to generate the cache key, which is also encoded into the file name and stored in the cache entry.extension (
str) – Extension filename (such as “.nc” for NetCDF, etc.), by default “.cache”.force (
callable,bool) – Method or flag to decide whether an already existing cache file should be regenerated.
- Returns:
path – Full path to the cache file.
- Return type:
str
Notes
The behaviour depends on the cache policy:
If the cache-policy is
userortemporarythe file is created in the
cache-directory and the relevant entries are added to the cache database using
Cache._register_cache_file().If the cache-policy is
offthe file is created in the temporary directory.
No cache database and monitoring is available. The cache directory is merely serving as a temporary space.