Spaces:
Sleeping
Sleeping
File size: 819 Bytes
bb44b67 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
"""
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
|