Skip to content

caching

DBCacheBase

Bases: ABC

Base class for DBCache.

find abstractmethod

find(key: str) -> Optional[Any]

Find a value in the cache by key.

Parameters:

  • key (str) –

    Cache key to look up

Returns:

  • Optional[Any]

    The cached value if found, None otherwise

Source code in src/appl/core/types/caching.py
@abstractmethod
def find(self, key: str) -> Optional[Any]:
    """Find a value in the cache by key.

    Args:
        key: Cache key to look up

    Returns:
        The cached value if found, None otherwise
    """
    pass

insert abstractmethod

insert(key: str, value: Any) -> None

Insert a value to the cache.

Parameters:

  • key (str) –

    Cache key

  • value (Any) –

    Value to cache (will be JSON serialized)

Source code in src/appl/core/types/caching.py
@abstractmethod
def insert(self, key: str, value: Any) -> None:
    """Insert a value to the cache.

    Args:
        key: Cache key
        value: Value to cache (will be JSON serialized)
    """
    pass