(feat) /cache/flushall

This commit is contained in:
Ishaan Jaff 2024-03-26 09:18:58 -07:00
parent 151b717ae2
commit b8af946fb9
2 changed files with 13 additions and 3 deletions

View file

@ -7754,13 +7754,20 @@ async def cache_ping():
@router.post(
"/cache/flush",
"/cache/flushall",
tags=["caching"],
dependencies=[Depends(user_api_key_auth)],
)
async def cache_flush():
async def cache_flushall():
"""
Endpoint for checking if cache can be pinged
A function to flush all items from the cache
Raises HTTPException if the cache is not initialized or if the cache type does not support flushing.
Returns a dictionary with the status of the operation.
Usage:
```
curl -X POST http://0.0.0.0:4000/cache/flushall -H "Authorization: Bearer sk-1234"
```
"""
try:
if litellm.cache is None: