yangdx
commited on
Commit
·
2549a80
1
Parent(s):
4e02c34
Replace delete() with drop_cache_by_modes() method to implement cache clearing operations
Browse files- lightrag/lightrag.py +10 -4
lightrag/lightrag.py
CHANGED
@@ -1894,12 +1894,18 @@ class LightRAG:
|
|
1894 |
try:
|
1895 |
# Reset the cache storage for specified mode
|
1896 |
if modes:
|
1897 |
-
await self.llm_response_cache.
|
1898 |
-
|
|
|
|
|
|
|
1899 |
else:
|
1900 |
# Clear all modes
|
1901 |
-
await self.llm_response_cache.
|
1902 |
-
|
|
|
|
|
|
|
1903 |
|
1904 |
await self.llm_response_cache.index_done_callback()
|
1905 |
|
|
|
1894 |
try:
|
1895 |
# Reset the cache storage for specified mode
|
1896 |
if modes:
|
1897 |
+
success = await self.llm_response_cache.drop_cache_by_modes(modes)
|
1898 |
+
if success:
|
1899 |
+
logger.info(f"Cleared cache for modes: {modes}")
|
1900 |
+
else:
|
1901 |
+
logger.warning(f"Failed to clear cache for modes: {modes}")
|
1902 |
else:
|
1903 |
# Clear all modes
|
1904 |
+
success = await self.llm_response_cache.drop_cache_by_modes(valid_modes)
|
1905 |
+
if success:
|
1906 |
+
logger.info("Cleared all cache")
|
1907 |
+
else:
|
1908 |
+
logger.warning("Failed to clear all cache")
|
1909 |
|
1910 |
await self.llm_response_cache.index_done_callback()
|
1911 |
|