sec_interp.core.interfaces.cache_interface module

Interface for Cache services.

class sec_interp.core.interfaces.cache_interface.ICacheService(*args, **kwargs)

Bases: Protocol

Abstract protocol for the Processing Data Cache Service.

clear() None

Clear the entire cache.

get(bucket: str, key: str) Any | None

Retrieve data from a specific cache bucket.

Parameters:
  • bucket – The cache category (e.g., ‘topo’, ‘geol’).

  • key – Unique key for the parameter set.

Returns:

The cached data or None if not found or expired.

get_metadata(bucket: str, key: str) dict[str, Any] | None

Retrieve metadata for a cached entry.

Parameters:
  • bucket – The cache category.

  • key – Unique key for the entry.

Returns:

Dictionary containing entry metadata or None if not found.

invalidate(bucket: str | None = None, key: str | None = None) None

Invalidate cache entries.

Parameters:
  • bucket – If provided, only invalidate this bucket.

  • key – If provided, only invalidate this specific key.

set(bucket: str, key: str, data: Any, metadata: dict | None = None) None

Store data in a specific cache bucket.

Parameters:
  • bucket – The cache category.

  • key – Unique key for the parameter set.

  • data – The data to cache.

  • metadata – Optional metadata (e.g., TTL, LOD info).