Caching¶
When you request a database the first time,
audb will unpack (and convert) annotations and data to
<cache>/<name>/<version>/<flavor>/.
Next time your request it again,
audb will directly load the database from there.
audb distinguishes two <cache> folders.
A system wide shared cache folder and a user cache folder.
User cache¶
The second cache folder should be accessible to you only. By default it points to
>>> audb.default_cache_root(shared=False)
'.../audb'
When you request a database with audb.load(),
audb first looks for it in the shared cache folder
and afterwards in your local cache folder.
Changing cache locations¶
There are four ways to change the default locations:
By setting the argument
cache_rootduring a function call, e.g.
>>> db = audb.load("emodb", ..., cache_root="/cache/root/audb")
System-wide by setting the following system variables
export AUDB_CACHE_ROOT=/new/local/cache/audb
export AUDB_SHARED_CACHE_ROOT=/new/shared/cache/audb
Program-wide by overwriting the default values in
audb.config
>>> audb.config.SHARED_CACHE_ROOT = "/new/shared/cache/audb"
>>> audb.default_cache_root(shared=True)
'/new/shared/cache/audb'
>>> audb.config.CACHE_ROOT = "/new/local/cache/audb"
>>> audb.default_cache_root(shared=False)
'/new/local/cache/audb'
System wide by using the configuration file
~/.config/audb.yaml
Note, 1. overwrites all other methods, 2. overwrites 3. and 4., and so on.