ptarjan / node-cache

A simple in-memory cache for nodejs
BSD 2-Clause "Simplified" License
1.59k stars 214 forks source link

feature suggestion: add a callback for expired entries #60

Open lamemind opened 8 years ago

lamemind commented 8 years ago

Hello,

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

Thanks

robertpallas commented 8 years ago

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:

Thoughts @ptarjan?

ptarjan commented 8 years ago

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 notifications@github.com 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.