Skip to content

Releases: node-cache/node-cache

Add .take() and .flushStats()

08 Dec 13:28
81fa811
Compare
Choose a tag to compare
  • 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

Fix deleteOnExpire: false

17 Nov 16:24
6117b2b
Compare
Choose a tag to compare
  • Fixed bug where expired values were deleted even though deleteOnExpire was set to false. Thanks to fielding-wilson for #154!

Fix null values

06 Nov 20:57
f5f2cb8
Compare
Choose a tag to compare

Drop lodash dependency and callbacks

06 Nov 20:47
5bd38ea
Compare
Choose a tag to compare
  • 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

4.2.1: Upgrade lodash to version 4.17.15

06 Nov 20:14
61e9554
Compare
Choose a tag to compare
  • Upgrade lodash to version 4.17.15 to avoid security issues

New Options + Typescript definitions

21 Mar 13:25
Compare
Choose a tag to compare
  • 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.

fix internal check interval

21 Dec 11:26
Compare
Choose a tag to compare
  • fix internal check interval for node < 0.10.25, thats the default node for ubuntu 14.04.
    Thanks to Jimmy Hwang for for the pull #78;
  • added more docker tests

key validation

24 Oct 07:46
Compare
Choose a tag to compare
  • Added tests for different key types
  • Added key validation (must be string or number)
  • Fixed .del bug where trying to delete a number key resulted in no deletion at all.

Breaking `.ttl` fix & Converted tests to mocha

23 Sep 07:56
Compare
Choose a tag to compare
  • Updated tests to mocha
  • Fixed .ttl bug to not delete key on .ttl( key, 0 ). This is also relevant if stdTTL=0.
    This causes the breaking change to 4.0.0.

lodash 4.x

21 Mar 07:37
Compare
Choose a tag to compare
  • Updated lodash to 4.x.
  • optimized grunt
  • updated dependencies
  • no more compiled code in the repo
  • dropped travis test for node 0.6 and 0.8 because of failing grunt build