Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.

biolearn.cache.LocalFolderCache#

class biolearn.cache.LocalFolderCache(path, max_size_gb)#

A cache that stores data as serialized objects in a local directory. Implements basic LRU (Least Recently Used) cleanup to maintain the cache within a specified maximum size limit.

__init__(path, max_size_gb)#

Initializes the LocalFolderCache instance.

Parameters:
  • path (str) – The filesystem path to the directory to be used for cache storage.

  • max_size_gb (float) – The maximum size of the cache in gigabytes.

get(key)#

Retrieves an item from the cache by its key, if it exists.

Parameters:

key (str) – The key for which the cache value is retrieved.

Returns:

The value stored in the cache, or None if the key does not exist or an error occurs.

Return type:

any

store(key, value)#

Stores an item in the cache under the specified key, managing the cache size to stay within limits.

Parameters:
  • key (str) – The key under which the value is stored.

  • value (any) – The value to be stored.

clear()#

Clears the cache by removing the cache directory and all its contents.