support clearing application code cache

This commit is contained in:
MaysWind
2026-03-11 00:52:43 +08:00
parent edcf33f49c
commit 13488efdaf
23 changed files with 82 additions and 1 deletions
@@ -12,6 +12,7 @@ import {
loadBrowserCacheStatistics,
updateMapCacheExpiration,
clearMapDataCache,
clearApplicationCodeCache,
clearAllBrowserCaches
} from '@/lib/cache.ts';
@@ -115,6 +116,7 @@ export function useAppBrowserCacheSettingPageBase() {
// functions
loadCacheStatistics,
clearMapDataCache,
clearApplicationCodeCache,
clearAllBrowserCaches,
clearExchangeRatesDataCache
};
@@ -72,6 +72,10 @@
:disabled="loading || !isSupportedFileCache || !fileCacheStatistics" @click="clearMapCache()">
{{ tt('Clear Map Data Cache') }}
</v-btn>
<v-btn color="secondary" variant="tonal"
:disabled="loading || !isSupportedFileCache || !fileCacheStatistics" @click="clearApplicationCodeFileCache()">
{{ tt('Clear Application Code Cache') }}
</v-btn>
<v-btn class="ms-2" color="secondary" variant="tonal"
:disabled="loading || !isSupportedFileCache || !fileCacheStatistics" @click="clearAllFileCache()">
{{ tt('Clear All File Cache') }}
@@ -180,6 +184,7 @@ const {
exchangeRatesDataCacheExpiration,
loadCacheStatistics,
clearMapDataCache,
clearApplicationCodeCache,
clearAllBrowserCaches,
clearExchangeRatesDataCache
} = useAppBrowserCacheSettingPageBase();
@@ -194,6 +199,14 @@ function clearMapCache(): void {
});
}
function clearApplicationCodeFileCache(): void {
confirmDialog.value?.open('Are you sure you want to clear application code cache?').then(() => {
clearApplicationCodeCache().then(() => {
loadCacheStatistics(true);
});
});
}
function clearAllFileCache(): void {
confirmDialog.value?.open('Are you sure you want to clear all file cache?').then(() => {
clearAllBrowserCaches().then(() => {
@@ -101,6 +101,8 @@
<f7-actions-group v-if="isSupportedFileCache && fileCacheStatistics">
<f7-actions-button :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }"
@click="clearMapCache">{{ tt('Clear Map Data Cache') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }"
@click="clearApplicationCodeFileCache">{{ tt('Clear Application Code Cache') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }"
@click="clearAllFileCache">{{ tt('Clear All File Cache') }}</f7-actions-button>
</f7-actions-group>
@@ -141,6 +143,7 @@ const {
exchangeRatesDataCacheExpiration,
loadCacheStatistics,
clearMapDataCache,
clearApplicationCodeCache,
clearAllBrowserCaches,
clearExchangeRatesDataCache
} = useAppBrowserCacheSettingPageBase();
@@ -165,6 +168,14 @@ function clearMapCache(): void {
});
}
function clearApplicationCodeFileCache(): void {
showConfirm('Are you sure you want to clear application code cache?', () => {
clearApplicationCodeCache().then(() => {
loadCacheStatistics(true);
});
});
}
function clearAllFileCache(): void {
showConfirm('Are you sure you want to clear all file cache?', () => {
clearAllBrowserCaches().then(() => {