Skip to main content

localForageLib extends localStorage with async access

falls back on localStorage in Browser if no indexedDB found

use to create new object to interact with new instance of indexedDB instance in browser

const fileCache = localForage.createInstance({
name: "filecache",
});

setItem to fileCache

await fileCache.setItem(args.path, result)

check if item is already in fileCache

const cachedResult = await fileCache.getItem(args.path);

return cached item if exists

if (cachedResult) return cachedResult;

References