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

Is this a bug about `this.del` function

Open songjinzhong opened this issue 7 years ago • 2 comments

https://github.com/ptarjan/node-cache/blob/27a1eeec18660b45d39cc5daf44d9647e696e48b/index.js#L53

When a record is about to expire, we take the initiative to delete it. And due to the running time of the program, oldRecord.expire < Date.now() === true, so the record will not be deleted.

songjinzhong avatar Feb 08 '18 14:02 songjinzhong

Yeah, that seems silly to me. If you’re manually invoking a delete function then jr shouldn’t matter wether or not the record is expiring. It should delete it regardless

AsynchronousToddler avatar Jun 23 '18 11:06 AsynchronousToddler

I think it’s an interesting idea to have a method that won't delete a key if it isn't expired. But it’s really strange when you don't have an opportunity to delete something that doesn’t expired. In my similar package memory-cache-pro you can use the ‘delete(key)’ method to delete something and it doesn’t check the key expiration time

IvanAdmaers avatar Jan 22 '22 17:01 IvanAdmaers