feat: optimize code

This commit is contained in:
martsforever
2025-09-27 20:29:23 +08:00
parent 7b3bf7d1dd
commit 97515ecfe7
+2 -1
View File
@@ -11,6 +11,7 @@ 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):
exists = bool(await redis_client.exists(key)) # exists = bool(await redis_client.exists(key))
mapping = await redis_client.hgetall(key) mapping = await redis_client.hgetall(key)
exists = bool(mapping)
return {"result": {"exists": exists, "mapping": mapping}} return {"result": {"exists": exists, "mapping": mapping}}