Spaces:
Running
Running
Download api/cache_reset.py from Leon4gr45/openoperator: direct link, hf CLI and curl.
- Browser
- Download file 785 Bytes
-
https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/api/cache_reset.py
- Command line
-
hf download hf://spaces/Leon4gr45/openoperator/api/cache_reset.py
-
curl -L -o cache_reset.py https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/api/cache_reset.py
785 Bytes
| from helpers.api import ApiHandler, Request, Response | |
| from helpers import cache | |
| class CacheReset(ApiHandler): | |
| def requires_auth(cls) -> bool: | |
| return False | |
| def requires_csrf(cls) -> bool: | |
| return False | |
| def requires_api_key(cls) -> bool: | |
| return False | |
| def requires_loopback(cls) -> bool: | |
| return True | |
| def get_methods(cls) -> list[str]: | |
| return ["GET", "POST"] | |
| async def process(self, input: dict, request: Request) -> dict | Response: | |
| areas = input.get("areas", []) | |
| if not areas: | |
| cache.clear_all() | |
| else: | |
| for area in areas: | |
| cache.clear(area) | |
| return {"ok": True} | |