MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / readCacheEntry

Function readCacheEntry

src/Data/CacheStore.js:61–73  ·  view source on GitHub ↗
(key, {legacyFields = [], requestEpoch = cacheEpoch} = {})

Source from the content-addressed store, hash-verified

59}
60
61export async function readCacheEntry(key, {legacyFields = [], requestEpoch = cacheEpoch} = {}) {
62 if (requestEpoch === cacheEpoch && memoryCache.has(key)) {
63 return memoryCache.get(key);
64 }
65 const pendingWrite = writeQueues.get(key);
66 if (pendingWrite) {
67 await pendingWrite.catch(() => {
68 });
69 if (requestEpoch === cacheEpoch && memoryCache.has(key)) {
70 return memoryCache.get(key);
71 }
72 }
73 const versionBeforeRead = latestRequestVersions.get(key) ?? 0;
74 const entry = normalizeCacheEntry(await localforage.getItem(key), legacyFields);
75 if (requestEpoch !== cacheEpoch || (latestRequestVersions.get(key) ?? 0) !== versionBeforeRead) {
76 return memoryCache.get(key) ?? null;

Callers 4

getMetadataBatchFunction · 0.90
readFreshCachedRecordsFunction · 0.90
getProgramDescsFunction · 0.90
loadCachedValueFunction · 0.85

Calls 1

normalizeCacheEntryFunction · 0.85

Tested by

no test coverage detected