cacheables.caches package

Submodules

cacheables.caches.base module

class cacheables.caches.base.BaseCache

Bases: ABC

abstract adopt(from_function_key: FunctionKey, to_function_key: FunctionKey) → None

Assumes the to_function is using the same cache as the from_function. e.g. both using DiskCache with the same base_path, etc.

abstract clear(function_key: FunctionKey) → None
abstract dump_metadata(metadata: dict, input_key: InputKey) → None
abstract evict(input_key: InputKey) → None
abstract exists(input_key: InputKey) → bool
abstract get_last_accessed(input_key: InputKey) → datetime | None
abstract get_output_path(input_key: InputKey) → str
abstract list(function_key: FunctionKey) → List[InputKey]
abstract load_metadata(input_key: InputKey) → dict
read(input_key: InputKey) → bytes
abstract read_output(metadata: dict, input_key: InputKey) → bytes
abstract update_last_accessed(input_key: InputKey) → None
write(output_bytes: bytes, metadata: dict, input_key: InputKey) → None
abstract write_output(output_bytes: bytes, metadata: dict, input_key: InputKey) → None

cacheables.caches.disk module

class cacheables.caches.disk.DiskCache(base_path: str | Path | None = None)

Bases: BaseCache

adopt(from_function_key: FunctionKey, to_function_key: FunctionKey) → None

Assumes the to_function is using the same cache as the from_function. e.g. both using DiskCache with the same base_path, etc.

clear(function_key: FunctionKey) → None
dump_metadata(metadata: dict, input_key: InputKey) → None
evict(input_key: InputKey) → None
exists(input_key: InputKey) → bool
get_last_accessed(input_key: InputKey) → datetime | None
get_output_path(input_key: InputKey) → str
list(function_key: FunctionKey) → List[InputKey]
load_metadata(input_key: InputKey) → dict
read_output(metadata: dict, input_key: InputKey) → bytes
update_last_accessed(input_key: InputKey) → None
write_output(output_bytes: bytes, metadata: dict, input_key: InputKey) → None
cacheables.caches.disk.acquire_lock(func)

Module contents