I am trying to set some cache using sourceNodes api and can't seem to get the cache to persist. I always get No Data for some reason. I looked inside of .cache/caches/[mypluginname]/[cacheFileHere] and it seems that on every run of gatsby develop it gets removed/recreated instead of just using the cache. Any ideas?
Here is my code:
exports.onSourceNodes = async (props) => {
const { cache } = props
const cacheKey = `cooltestkey`
const testData = { fig: "newton" }
let data = await cache.get(cacheKey)
if(!data) {
console.log(`I don't exist`)
await cache.set(cacheKey, testData)
} else {
console.log(`Hello I exist`)
}
}