A non existing value return "undefined", where deleting a value just replace the value by "null", so getting the deleted value return null .
I've done some research in the code, and in fact, I doesn't understand this line :
https://github.com/cayasso/cacheman-memory/blob/master/src/index.js#L39
if (data.expire !== -1 && data.expire < Date.now()) {
To remove a value, you set the data.expire to -1, so why checking if data.expire !== -1 to delete it ?
I think, this line need to be :
if (data.expire === -1 || data.expire < Date.now()) {
Or directly
if (data.expire < Date.now()) {
Else, the deleted value (replaced by null), is returned ...
A non existing value return "undefined", where deleting a value just replace the value by "null", so getting the deleted value return null .
I've done some research in the code, and in fact, I doesn't understand this line :
https://github.com/cayasso/cacheman-memory/blob/master/src/index.js#L39
if (data.expire !== -1 && data.expire < Date.now()) {To remove a value, you set the
data.expireto-1, so why checking if data.expire !== -1 to delete it ?I think, this line need to be :
if (data.expire === -1 || data.expire < Date.now()) {Or directly
if (data.expire < Date.now()) {Else, the deleted value (replaced by
null), is returned ...