jonra1993 / fastapi-alembic-sqlmodel-async

This is a project template which uses FastAPI, Pydantic 2.0, Alembic and async SQLModel as ORM. It shows a complete async CRUD using authentication and role base access control.
MIT License
964 stars 150 forks source link

Use redis cache some user info, avoid get_current_user frequent database access #35

Closed dongfengweixiao closed 1 year ago

dongfengweixiao commented 1 year ago

I think use redis cache some user info is a good idea, it avoid get_current_user frequent database access, but the design is a little complicated, and I'm considering the details. What do you think about this? @jonra1993

jonra1993 commented 1 year ago

Hello @dongfengweixiao please check this https://github.com/zhanymkanov/fastapi-best-practices#5-decouple--reuse-dependencies-dependency-calls-are-cached I do not think that this is needed due to get_current_user is used as a dependency.

dongfengweixiao commented 1 year ago

Hello @dongfengweixiao please check this https://github.com/zhanymkanov/fastapi-best-practices#5-decouple--reuse-dependencies-dependency-calls-are-cached I do not think that this is needed due to get_current_user is used as a dependency.

THANK your replay, this url have some very valuable information.