feat: 添加清除 Service Worker 缓存功能,优化缓存管理逻辑
This commit is contained in:
@@ -75,6 +75,14 @@ export function useCacheSize() {
|
||||
// 清除 sessionStorage
|
||||
sessionStorage.clear();
|
||||
|
||||
// 清除 Service Worker 缓存
|
||||
if ("serviceWorker" in navigator) {
|
||||
const registrations = await navigator.serviceWorker.getRegistrations();
|
||||
for (const registration of registrations) {
|
||||
await registration.unregister();
|
||||
}
|
||||
}
|
||||
|
||||
// 清除 Cache API 缓存
|
||||
if ("caches" in window) {
|
||||
const cacheNames = await caches.keys();
|
||||
|
||||
Reference in New Issue
Block a user