class RemoteCache

source code

Remote cache implementation using the logging system.

setters


set_cache_name

source code

def set_cache_name(cls, name: str) -> None:
Set the remote context name for the cache.

methods


get_cache_name

source code

def get_cache_name(cls) -> str:
Get the current remote context name.

has_key

source code

def has_key(cls, key: str) -> bool:
Check if a key exists in the remote cache.

initialize_cache

source code

def initialize_cache(cls, name: str = None) -> None:
Ensure the remote context exists.

list_keys

source code

def list_keys(cls) -> List[str]:
Get a list of all cache keys from the remote context.

remove_entry

source code

def remove_entry(cls, key: str) -> None:
Remove an entry from the remote cache.

retrieve_entry

source code

def retrieve_entry(cls, key: str) -> tuple[Optional[Any], Optional[Dict[str, Any]]]:
Retrieve a value from the remote cache. Returns: Tuple of (value, res_types) or (None, None) if not found

serialize_object

source code

def serialize_object(
        obj: Any,
        cached_types: Dict[str, str] = None,
        idx: List[Union[str, int]] = None,
        indent: int = None,
    ) -> Any:
Serialize an object to a JSON-serializable format. Arguments:
  • obj - Object to serialize
  • type_registry - Dictionary to track object types for reconstruction
  • path - Current path in the object structure
  • indent - JSON indentation level
Returns: Serialized object or JSON string if at root level

store_entry

source code

def store_entry(
        cls,
        *,
        key: str,
        value: Any,
        res_types: Optional[Dict[str, Any]] = None,
    ) -> None:
Store a key-value pair in the remote cache.

write

source code

def write(cls, filename: str = None) -> None:
No-op for remote cache - data is persisted immediately.