Skip to content

@erdii erdii released this Dec 8, 2019

  • Add .take(key) method to get and delete a key with a single operation. #159 #160
  • Add .flushStats() method to reset all cache stats back to 0. #158 #161
Assets 2

@erdii erdii released this Nov 17, 2019 · 75 commits to master since this release

  • Fixed bug where expired values were deleted even though deleteOnExpire was set to false. Thanks to fielding-wilson for #154!
Assets 2

@erdii erdii released this Nov 6, 2019 · 80 commits to master since this release

Assets 2

@erdii erdii released this Nov 6, 2019 · 86 commits to master since this release

  • Remove lodash dependency
  • DROP CALLBACK SUPPORT - Read the migration guide if you are currently using the callback based api! ⚠️
  • add .has(key) and method - Thanks to Regev Brody for PR [#132]!
  • add .mset([{key,val,ttl}]) method - Thanks to Sujesh Thekkepatt for PR [#142]!
  • add maxKeys setting to limit cache size - Thanks do @daluf for PR [#141]!
  • Also, thank you to all other contributors that remain unnamed here! 🎉

MIGRATION GUIDE 🚧

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
Assets 2
Oct 18, 2019
5.0.0-alpha.1
Jul 24, 2019
Upgrade lodash to version 4.17.15 to suppress messages about unrelate…
…d security vulnerability

@erdii erdii released this Nov 6, 2019 · 159 commits to master since this release

  • Upgrade lodash to version 4.17.15 to avoid security issues
Assets 2

@mpneuried mpneuried released this Mar 21, 2018 · 159 commits to master since this release

  • Add options.promiseValueSize for promise value. Thanks to Ryan Roemer for the pull [#84]
  • Added option deleteOnExpire
  • Added DefinitelyTyped Typescript definitions. Thanks to Ulf Seltmann for the pulls [#90] and [#92]
  • Thanks to Daniel Jin for the readme fix in pull [#93]
  • Optimized test and ci configs.
Assets 2
You can’t perform that action at this time.