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

how do i get cache and update time expired?

Open thichpv opened this issue 7 years ago • 1 comments

how do i get cache and update time expired? Thank you!

thichpv avatar Jul 23 '18 07:07 thichpv

There are no ways to delete not expired key in this package. If you use my similar package memory-cache-pro it’s possible by following the steps below.

// Get the cache
const value = cache.get(‘key’);
// Delete current key
cache.delete(‘key’);
// Set a new key with a new time
const 1hour = 1 * 1000 * 60 * 60;
cache.put(‘key’, value, 1hour);

IvanAdmaers avatar Jan 22 '22 16:01 IvanAdmaers