a node internal (in-memory) caching module
We have dropped callback support in node-cache and you should migrate to our sync-style api!
If you cannot refactor right now, you can turn on legacy callback support by enabling the enableLegacyCallbacks
option. Eg: const cache = new NodeCache({ enableLegacyCallbacks: true })
But we strongly recommend to refactor your code to use the sync-api because we will drop official callback support in Versions v6.x and onwards.
If your code currently looks like this:
cache.get("my-key", function(err, value) {
if (err) {
// ...
}
// double equal checks for null and undefined
if (value != null) {
// hmm.... nothing here :(
}
// do something with value
});
it should be rewritten to:
const value = cache.get("my-key");
// double equal checks for null and undefined
if (value != null) {
// hmm.... nothing here :(
}
// do something with value
string
or number
).del
bug where trying to delete a number
key resulted in no deletion at all..ttl
bug to not delete key on .ttl( key, 0 )
. This is also relevant if stdTTL=0
.4.0.0
.
0.6
and 0.8
because of failing grunt build