Closed msetten closed 1 year ago
My current working around is using:
if ( typeof cache.get(key) !== "undefined" ) {
cache.delete(key);
}
cache.set(key, value);
But I think that shouldn't be necessary to use.
@msetten , thanks for pointing this out. Will provide a flag force: boolean
on set
method, so that you can decide whether to override an existing value or not, so that the library would be backwards compatible.
Hi @msetten , have added support for force setting a value in cache by using cache.set('foo', 'bar', true)
. Please upgrade the library to @akashbabu/lfu-cache@1.1.0
I have the issue that setting a new value for an existing key, won't save the new value, but retains the old value.
This is piece of code with test logging:
The console log show: