Skip to content

Commit

Permalink
💄 fix: キャッシュサイズの計算処理を復元してコメントアウト
Browse files Browse the repository at this point in the history
  • Loading branch information
reiroop committed Sep 24, 2024
1 parent 26fd08b commit 34d9ea1
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,42 @@ const cacheNames = async (category: CacheCategory) => {
const allNames = await window.caches.keys()
return allNames.filter(name => name.startsWith(category))
}
// const cacheSize = ref(
// Object.fromEntries(cacheCategories.map(name => [name, '計算中...']))
// )
// const updateCacheSize = async () => {
// await Promise.all(
// cacheCategories.map(async category => {
// cacheSize.value[category] = prettifyFileSize(
// await calculateCacheSizeSum(await cacheNames(category))
// )
// })
// )
// }
// onMounted(updateCacheSize)
// const calculateCacheSizeSum = async (cacheNames: string[]) => {
// let size = 0
// await Promise.all(
// cacheNames.map(async cacheName => {
// size += await calculateEachCacheSize(cacheName)
// })
// )
// return size
// }
// const calculateEachCacheSize = async (cacheName: string) => {
// const cache = await window.caches.open(cacheName)
// const keys = await cache.keys()
// let size = 0
// await Promise.all(
// keys.map(async key => {
// const response = await cache.match(key)
// if (!response) return
// const blob = await response.blob()
// size += blob.size
// })
// )
// return size
// }
const cacheLabel = (cacheCategory: CacheCategory) => {
switch (cacheCategory) {
Expand Down

0 comments on commit 34d9ea1

Please sign in to comment.