cosmo/clear_all_caches.py

29 lines
754 B
Python

#!/usr/bin/env python3
"""Clear all caches to force fresh data"""
import asyncio
import sys
import os
sys.path.append(os.path.join(os.getcwd(), "backend"))
from app.services.redis_cache import redis_cache
from app.services.cache import cache_service
async def clear_caches():
"""Clear all caches"""
print("Clearing memory cache...")
cache_service.clear()
print("✓ Memory cache cleared")
print("\nClearing Redis cache...")
try:
await redis_cache.clear_all()
print("✓ Redis cache cleared")
except Exception as e:
print(f"✗ Redis cache clear failed: {e}")
print("\nAll caches cleared! Fresh data will be loaded on next request.")
if __name__ == "__main__":
asyncio.run(clear_caches())