split up application
Build and Push Docker Images / build-and-push (push) Successful in 33s

This commit is contained in:
2025-05-02 21:15:30 +02:00
parent 2b893ca47a
commit de3919a4b5
15 changed files with 1020 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
from fastapi import APIRouter, HTTPException, Header
from typing import Optional
from app.config import API_KEY
from app.services.cache import clear_cache, get_cache_stats
router = APIRouter()
@router.get("/cache/clear")
async def clear_cache_route(x_api_key: Optional[str] = Header(None)):
"""Clear the entire cache database"""
# Validate API key
if not x_api_key or x_api_key != API_KEY:
raise HTTPException(status_code=401, detail="Invalid API key")
return clear_cache()
@router.get("/cache/stats")
async def cache_stats_route(x_api_key: Optional[str] = Header(None)):
"""Get cache statistics"""
# Validate API key
if not x_api_key or x_api_key != API_KEY:
raise HTTPException(status_code=401, detail="Invalid API key")
return get_cache_stats()