Spaces:
Running
Running
Download extensions/webui/webui_ws_push/clear_cache.js from Leon4gr45/openoperator: direct link, hf CLI and curl.
- Browser
- Download file 549 Bytes
-
https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/extensions/webui/webui_ws_push/clear_cache.js
- Command line
-
hf download hf://spaces/Leon4gr45/openoperator/extensions/webui/webui_ws_push/clear_cache.js
-
curl -L -o clear_cache.js https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/extensions/webui/webui_ws_push/clear_cache.js
549 Bytes
| import { clear, clear_all } from "/js/cache.js"; | |
| export default async function clearCache(eventType, envelope) { | |
| try { | |
| // clear frontend cache areas when backend caches are cleared via API | |
| if (eventType == "clear_cache") { | |
| const areas = envelope?.data?.areas || []; | |
| console.log("Clearing caches", areas); | |
| if (areas.length > 0) { | |
| for (const area of areas) { | |
| clear(area); | |
| } | |
| } else { | |
| // clear all caches | |
| clear_all(); | |
| } | |
| } | |
| } catch (e) { | |
| console.error(e); | |
| } | |
| } | |