feat: optimize code
This commit is contained in:
@@ -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}}
|
||||||
|
|||||||
Reference in New Issue
Block a user