mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
(feat) /cache/flushall
This commit is contained in:
parent
151b717ae2
commit
b8af946fb9
2 changed files with 13 additions and 3 deletions
|
@ -334,6 +334,9 @@ class RedisCache(BaseCache):
|
||||||
def flush_cache(self):
|
def flush_cache(self):
|
||||||
self.redis_client.flushall()
|
self.redis_client.flushall()
|
||||||
|
|
||||||
|
def flushall(self):
|
||||||
|
self.redis_client.flushall()
|
||||||
|
|
||||||
async def disconnect(self):
|
async def disconnect(self):
|
||||||
await self.async_redis_conn_pool.disconnect(inuse_connections=True)
|
await self.async_redis_conn_pool.disconnect(inuse_connections=True)
|
||||||
|
|
||||||
|
|
|
@ -7754,13 +7754,20 @@ async def cache_ping():
|
||||||
|
|
||||||
|
|
||||||
@router.post(
|
@router.post(
|
||||||
"/cache/flush",
|
"/cache/flushall",
|
||||||
tags=["caching"],
|
tags=["caching"],
|
||||||
dependencies=[Depends(user_api_key_auth)],
|
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:
|
try:
|
||||||
if litellm.cache is None:
|
if litellm.cache is None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue