feat: optimize code

This commit is contained in:
martsforever
2025-09-27 20:28:06 +08:00
parent c9c3ae91e1
commit 7b3bf7d1dd
+3 -1
View File
@@ -11,4 +11,6 @@ def add_redis_route(app: FastAPI):
@app.get("/redis_get/{key}") @app.get("/redis_get/{key}")
async def redis_get(key: str, redis_client: RedisClientDep): async def redis_get(key: str, redis_client: RedisClientDep):
return {"result": await redis_client.hgetall(key)} exists = bool(await redis_client.exists(key))
mapping = await redis_client.hgetall(key)
return {"result": {"exists": exists, "mapping": mapping}}