I'm using node-cache 5.1.2 and this is the little example code that I have:
import NodeCache from 'node-cache'
const cache = new NodeCache({
stdTTL: 900,
checkperiod: 900 / 5,
useClones: false,
})
cache.set('hello', undefined)
const restored = cache.get('hello') // incorrectly returns null
I found this already closed issue, don't know whether it is caused by same thing, but the issue still definitely persists.
If anyone finds this issue my current workaround is to wrap every data that I store into an object, like this:
cache.set('workaround', { value: undefined })
const restored = cache.get('workaround').value // correctly returns undefined