Nicer delete
This commit is contained in:
parent
a86cdb1f1e
commit
c52fd4383c
1 changed files with 10 additions and 13 deletions
|
@ -136,9 +136,7 @@ const openWebCache = async (name: BlobCacheNamespace) => {
|
|||
put: (key: string, data: Response) => {
|
||||
return cache.put(key, data);
|
||||
},
|
||||
delete: (key: string) => {
|
||||
return cache.delete(key);
|
||||
},
|
||||
delete: (key: string) => cache.delete(key),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -184,16 +182,15 @@ const openOPFSCacheWeb = async (name: BlobCacheNamespace) => {
|
|||
put: async (key: string, data: Response) => {
|
||||
await cache.put(key, data);
|
||||
},
|
||||
delete: (key: string) => {
|
||||
// try {
|
||||
// await _cache.removeEntry(key);
|
||||
// return true;
|
||||
// } catch (e) {
|
||||
// if (e instanceof DOMException && e.name == "NotFoundError")
|
||||
// return false;
|
||||
// throw e;
|
||||
// }
|
||||
return cache.delete(key);
|
||||
delete: async (key: string) => {
|
||||
try {
|
||||
await _cache.removeEntry(key);
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (e instanceof DOMException && e.name == "NotFoundError")
|
||||
return false;
|
||||
throw e;
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue