mirror of
https://github.com/flibusta-apps/users_settings_server.git
synced 2025-12-06 14:45:38 +01:00
Add redis cache
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
import aioredis
|
||||
from fastapi_pagination import add_pagination
|
||||
|
||||
from app.views import users_router, languages_router, healthcheck_router
|
||||
from core.config import env_config
|
||||
from core.db import database
|
||||
|
||||
|
||||
@@ -15,6 +17,13 @@ def start_app() -> FastAPI:
|
||||
|
||||
app.state.database = database
|
||||
|
||||
app.state.redis = aioredis.Redis(
|
||||
host=env_config.REDIS_HOST,
|
||||
port=env_config.REDIS_PORT,
|
||||
db=env_config.REDIS_DB,
|
||||
password=env_config.REDIS_PASSWORD,
|
||||
)
|
||||
|
||||
add_pagination(app)
|
||||
|
||||
@app.on_event("startup")
|
||||
|
||||
Reference in New Issue
Block a user