Spaces:
Running
Running
| """ | |
| Domain Layer - Cache Interface | |
| Defines contract for caching implementations. | |
| """ | |
| from abc import ABC, abstractmethod | |
| from typing import Any, Optional | |
| class ICache(ABC): | |
| """Interface for cache implementations""" | |
| async def get(self, key: str) -> Optional[Any]: | |
| """Get value from cache""" | |
| pass | |
| async def set(self, key: str, value: Any, ttl: Optional[int] = None) -> bool: | |
| """Set value in cache""" | |
| pass | |
| async def delete(self, key: str) -> bool: | |
| """Delete key from cache""" | |
| pass | |
| async def exists(self, key: str) -> bool: | |
| """Check if key exists""" | |
| pass | |
| async def clear(self, pattern: str = "*") -> int: | |
| """Clear cache by pattern""" | |
| pass | |