feat: implement Redis caching for analytics endpoints with fallback to database
Test / test (push) Successful in 15s

This commit is contained in:
k1nq
2025-11-29 09:45:27 +05:00
parent 31d6a05521
commit fbb3116a2d
15 changed files with 671 additions and 13 deletions
+12
View File
@@ -2,13 +2,25 @@
from fastapi import FastAPI
from app.api.routes import api_router
from app.core.cache import init_cache, shutdown_cache
from app.core.config import settings
from app.core.middleware.cache_monitor import CacheAvailabilityMiddleware
def create_app() -> FastAPI:
"""Build FastAPI application instance."""
application = FastAPI(title=settings.project_name, version=settings.version)
application.include_router(api_router)
application.add_middleware(CacheAvailabilityMiddleware)
@application.on_event("startup")
async def _startup() -> None:
await init_cache()
@application.on_event("shutdown")
async def _shutdown() -> None:
await shutdown_cache()
return application