siibra.retrieval.cache

Maintaining and hadnling caching files on disk.

Attributes

CACHE

Classes

Cache

Functions

assert_folder(folder)

Module Contents

class siibra.retrieval.cache.Cache
build_filename(str_rep: str, suffix=None)

Generate a filename in the cache.

Args:

str_rep (str): Unique string representation of the item. Will be used to compute a hash. suffix (str, optional): Optional file suffix, in order to allow filetype recognition by the name. Defaults to None.

Returns:

filename

clear()
classmethod instance()

Return an instance of the siibra cache. Create folder if needed.

run_maintenance()

Shrinks the cache by deleting oldest files first until the total size is below cache size (Cache.SIZE) given in GiB.

SIZE_GIB = 2
folder = b'.'
property size

Return size of the cache in GiB.

siibra.retrieval.cache.assert_folder(folder)
siibra.retrieval.cache.CACHE = None