feat(图片缓存功能): 修复版本更新时,旧的assets没清除的问题,并暂时设置成小更新也清除全部缓存,以适配目前的旧缓存没法用的机制,后面再看单独设置一个图片版本号
This commit is contained in:
parent
4885766adb
commit
d4a55363bb
@ -187,7 +187,10 @@ class ImageCacheManager {
|
||||
try {
|
||||
const cacheNames = await caches.keys()
|
||||
const oldCaches = cacheNames.filter(
|
||||
(name) => name.startsWith('likei-images-v') && name !== this.imageCacheName
|
||||
(name) =>
|
||||
(name.startsWith('likei-images-v') || name.startsWith('likei-assets-v')) &&
|
||||
name !== this.imageCacheName &&
|
||||
name !== this.assetCacheName
|
||||
)
|
||||
|
||||
await Promise.all(oldCaches.map((name) => caches.delete(name)))
|
||||
|
||||
@ -103,8 +103,8 @@ export class VersionChecker {
|
||||
this.clearSessionData() // 清除 session 数据
|
||||
break
|
||||
case 'patch':
|
||||
// 日常小更新:不清除缓存
|
||||
// await imageCacheManager.clearCacheSelective('images') // 小更新:只清除图片缓存
|
||||
// 日常小更新:清除缓存
|
||||
await imageCacheManager.clearCacheSelective('all') // 小更新:清除图片和assets缓存
|
||||
break
|
||||
default:
|
||||
// 默认:清除所有缓存
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user