Baktabek's picture
Upload folder using huggingface_hub
409c17a verified
raw
history blame contribute delete
883 Bytes
"""
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"""
@abstractmethod
async def get(self, key: str) -> Optional[Any]:
"""Get value from cache"""
pass
@abstractmethod
async def set(self, key: str, value: Any, ttl: Optional[int] = None) -> bool:
"""Set value in cache"""
pass
@abstractmethod
async def delete(self, key: str) -> bool:
"""Delete key from cache"""
pass
@abstractmethod
async def exists(self, key: str) -> bool:
"""Check if key exists"""
pass
@abstractmethod
async def clear(self, pattern: str = "*") -> int:
"""Clear cache by pattern"""
pass