Spaces:
Running
Running
Download src/adapters/interfaces/cache.py from Leon4gr45/brain: direct link, hf CLI and curl.
- Browser
- Download file 1.76 kB
-
https://huggingface.co/spaces/Leon4gr45/brain/resolve/main/src/adapters/interfaces/cache.py
- Command line
-
hf download hf://spaces/Leon4gr45/brain/src/adapters/interfaces/cache.py
-
curl -L -o cache.py https://huggingface.co/spaces/Leon4gr45/brain/resolve/main/src/adapters/interfaces/cache.py
1.76 kB
| """ | |
| File: /cache.py | |
| Created Date: Sunday October 19th 2025 | |
| Author: Christian Nonis <alch.infoemail@gmail.com> | |
| ----- | |
| Last Modified: Sunday October 19th 2025 9:01:18 am | |
| Modified By: the developer formerly known as Christian Nonis at <alch.infoemail@gmail.com> | |
| ----- | |
| """ | |
| from abc import ABC, abstractmethod | |
| from typing import Optional | |
| class CacheClient(ABC): | |
| """ | |
| Abstract base class for cache clients. | |
| """ | |
| def get(self, key: str, brain_id: str) -> str: | |
| """ | |
| Get a value from the cache. | |
| """ | |
| raise NotImplementedError("get method not implemented") | |
| def set( | |
| self, key: str, value: str, brain_id: str, expires_in: Optional[int] = None | |
| ) -> bool: | |
| """ | |
| Set a value in the cache with an expiration time. | |
| Args: | |
| key: The key to set. | |
| value: The value to set. | |
| expires_in: The expiration time in seconds. | |
| Returns: | |
| True if the value was set, False otherwise. | |
| """ | |
| raise NotImplementedError("set method not implemented") | |
| def delete(self, key: str, brain_id: str) -> bool: | |
| """ | |
| Delete a value from the cache. | |
| """ | |
| raise NotImplementedError("delete method not implemented") | |
| def get_task_keys(self, brain_id: str) -> list[str]: | |
| """ | |
| Get all task keys for a given brain_id. | |
| """ | |
| raise NotImplementedError("get_task_keys method not implemented") | |
| def get_task(self, task_id: str, brain_id: str) -> Optional[str]: | |
| """ | |
| Get a specific task by ID. | |
| """ | |
| raise NotImplementedError("get_task method not implemented") | |