tusharf5/runtime-memcache

set does not override existing value

ayZagen opened this issue · 2 comments

Describe the bug
set method does not override value if the entry exists with given key.

To Reproduce
A simple example:

const runtimeMemcache = require("runtime-memcache")

const cache = runtimeMemcache({
  policy: 'tlru',
  lruSize: 100,
  timeToClear: 1800000
});

cache.set('key', 1)
cache.set('key', 2)

console.assert( cache.get('key') === 2 )

Expected behavior
It should override the value

Additional context
Maybe it is by design, if so it does not match the common usage, but it is not documented anywhere too or I could not find it.

Thanks for the great library.

Sorry for very late reply. Github didn't send me a notification for this. I will take a look at this and get back to you.

This behaviour is now implemented in the latest v3 version. Let me know if you find any issues.