node-cache icon indicating copy to clipboard operation
node-cache copied to clipboard

feature suggestion: add a callback for expired entries

Open lamemind opened this issue 8 years ago • 2 comments

Hello,

At this precise moment, I'd really love a callback called just before (or right after) an entry expires.

Thanks

lamemind avatar Mar 10 '16 22:03 lamemind

There is timeout callback, undocumented.

It runs after the key is deleted without sending the value into it. One of the 2 should be available:

  • (preferably) sending both the key and the value to the callback
  • running delete after callback so that the value could be accessed from the cache

Thoughts @ptarjan?

robertpallas avatar Jun 07 '16 14:06 robertpallas

I like it happening after the delete since the notion of a callback is to tell you once it is done. Is be open to adding the value if you send a PR (and add it to the docs :))

Sent from my iPhone

On Jun 7, 2016, at 7:14 AM, Robert Pallas [email protected] wrote:

There is timeout callback, undocumented.

It runs after the key is deleted without sending the value into it. One of the 2 should be available:

(preferably) sending both the key and the value to the callback running delete after callback so that the value could be accessed from the cache Thoughts @ptarjan?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

ptarjan avatar Jun 07 '16 17:06 ptarjan