| 69 | |
| 70 | |
| 71 | class AbstractCacheBackend(ABC): |
| 72 | @abstractmethod |
| 73 | def init_db(self): |
| 74 | pass |
| 75 | |
| 76 | @abstractmethod |
| 77 | def all(self): |
| 78 | pass |
| 79 | |
| 80 | @abstractmethod |
| 81 | def all_length(self) -> int: |
| 82 | pass |
| 83 | |
| 84 | @abstractmethod |
| 85 | def random(self, size: int) -> list[CacheResponse]: |
| 86 | pass |
| 87 | |
| 88 | @abstractmethod |
| 89 | def pull(self, key: str) -> Union[CacheResponse, None]: |
| 90 | pass |
| 91 | |
| 92 | @abstractmethod |
| 93 | def push(self, key: str, value: Union[str, dict]) -> None: |
| 94 | pass |
| 95 | |
| 96 | @abstractmethod |
| 97 | def delete(self, key: str) -> None: |
| 98 | pass |
| 99 | |
| 100 | @abstractmethod |
| 101 | def close(self): |
| 102 | pass |
| 103 | |
| 104 | |
| 105 | class SQLiteCacheBackend(AbstractCacheBackend): |
nothing calls this directly
no outgoing calls
no test coverage detected