aiflows.flow_cache package

Submodules

aiflows.flow_cache.flow_cache module

class aiflows.flow_cache.flow_cache.CACHING_PARAMETERS(max_cached_entries: int = 10000, do_caching: bool = True, cache_dir: str = None)

Bases: object

This class contains the global caching parameters.

Parameters:
  • max_cached_entries (int, optional) – The maximum number of cached entries

  • do_caching (bool, optional) – Whether to do caching

  • cache_dir (str, optional) – The cache directory

cache_dir: str = None
do_caching: bool = True
max_cached_entries: int = 10000
class aiflows.flow_cache.flow_cache.CachingKey(flow: Flow, input_data: Dict[str, Any], keys_to_ignore_for_hash: List[str])

Bases: object

This class contains the caching key.

Parameters:
  • flow (Flow) – The flow

  • input_data (Dict) – The input data

  • keys_to_ignore_for_hash (List) – The keys to ignore for the hash

flow: Flow
hash_string() str
input_data: Dict[str, Any]
keys_to_ignore_for_hash: List[str]
class aiflows.flow_cache.flow_cache.CachingValue(output_results: Dict, full_state: Dict, history_messages_created: List)

Bases: object

This class contains the cached value.

Parameters:
  • output_results (Dict) – The output results

  • full_state (Dict) – The full state

  • history_messages_created (List) – The history messages created

full_state: Dict
history_messages_created: List
output_results: Dict
class aiflows.flow_cache.flow_cache.FlowCache

Bases: object

This class is the flow cache.

Parameters:
  • index (Index) – The index

  • __lock (threading.Lock) – The lock

get(key: str) CachingValue | None

Returns the cached value for the given key.

Parameters:

key (str) – The key

Returns:

The cached value

Return type:

Optional[CachingValue]

pop(key: str)

Pops the cached value for the given key.

Parameters:

key (str) – The key

set(key: str, value: CachingValue)

Sets the cached value for the given key.

Parameters:
  • key (str) – The key

  • value (CachingValue) – The cached value

aiflows.flow_cache.flow_cache.clear_cache()

Clears the cache.

aiflows.flow_cache.flow_cache.get_cache_dir() str

Returns the cache directory.

Returns:

The cache directory

Return type:

str

Module contents