(key, {requestEpoch = cacheEpoch, requestVersion} = {})
| 96 | } |
| 97 | |
| 98 | export async function removeCacheValue(key, {requestEpoch = cacheEpoch, requestVersion} = {}) { |
| 99 | if (requestEpoch !== cacheEpoch) { |
| 100 | return false; |
| 101 | } |
| 102 | const version = requestVersion ?? nextRequestVersion(key); |
| 103 | if (version < (latestRequestVersions.get(key) ?? 0)) { |
| 104 | return false; |
| 105 | } |
| 106 | memoryCache.delete(key); |
| 107 | return enqueueCacheWrite(key, async () => { |
| 108 | if (requestEpoch !== cacheEpoch || version < (latestRequestVersions.get(key) ?? 0)) { |
| 109 | return false; |
| 110 | } |
| 111 | await localforage.removeItem(key); |
| 112 | return true; |
| 113 | }); |
| 114 | } |
| 115 | |
| 116 | export async function clearDataCache() { |
| 117 | const theme = await localforage.getItem("theme"); |
no test coverage detected