Spaces:
Running
Running
Download app/api/admin.py from SPerva/pillchecker-staging: direct link, hf CLI and curl.
- Browser
- Download file 549 Bytes
-
https://huggingface.co/spaces/SPerva/pillchecker-staging/resolve/main/app/api/admin.py
- Command line
-
hf download hf://spaces/SPerva/pillchecker-staging/app/api/admin.py
-
curl -L -o admin.py https://huggingface.co/spaces/SPerva/pillchecker-staging/resolve/main/app/api/admin.py
549 Bytes
| """Admin endpoints for cache management.""" | |
| import logging | |
| from fastapi import APIRouter | |
| from app.clients import openfda_client, rxnorm_client | |
| logger = logging.getLogger(__name__) | |
| router = APIRouter(prefix="/admin", tags=["admin"]) | |
| async def clear_cache(): | |
| """Clear all in-memory caches. Requires API key authentication.""" | |
| rxnorm_client._cache.clear() | |
| openfda_client._cache.clear() | |
| logger.info("All caches cleared via admin endpoint") | |
| return {"status": "ok", "message": "All caches cleared"} | |