Spaces:
Running
Running
| """ | |
| Infrastructure - No-Op Cache (Fallback when Redis unavailable) | |
| """ | |
| from typing import Any, Optional | |
| from app.domain.interfaces import ICache | |
| class NoOpCache(ICache): | |
| """No-operation cache - does nothing (fallback)""" | |
| async def get(self, key: str) -> Optional[Any]: | |
| """Always return None (cache miss)""" | |
| return None | |
| async def set(self, key: str, value: Any, ttl: Optional[int] = None) -> bool: | |
| """Do nothing, return True""" | |
| return True | |
| async def delete(self, key: str) -> bool: | |
| """Do nothing, return True""" | |
| return True | |
| async def exists(self, key: str) -> bool: | |
| """Always return False""" | |
| return False | |
| async def clear(self) -> bool: | |
| """Do nothing, return True""" | |
| return True | |