Fix: Add ping method to RedisClient for health checks

This commit is contained in:
Geutebruck API Developer
2025-12-09 14:52:35 +01:00
parent 797cee8695
commit 7b9aab9e8b

View File

@@ -37,6 +37,10 @@ class RedisClient:
logger.error("redis_connection_failed", error=str(e))
raise
async def disconnect(self):
"""Disconnect Redis (alias for close)"""
await self.close()
async def close(self):
"""Close Redis connections"""
try:
@@ -48,6 +52,15 @@ class RedisClient:
except Exception as e:
logger.error("redis_close_failed", error=str(e))
async def ping(self) -> bool:
"""Ping Redis to check connectivity"""
if not self._client:
return False
try:
return await self._client.ping()
except Exception:
return False
async def get(self, key: str) -> Optional[str]:
"""Get value by key"""
if not self._client: