Skip to content

icache has no eviction mechanism for individual key/values #604

@matt-gadd

Description

@matt-gadd

Enhancement

Code

console.log(icache.getOrSet('foo', 'a'));
icache.set('foo', undefined);
console.log(icache.getOrSet('foo', 'b'));

Expected behavior:
logs:

a
b

Actual behavior:
logs:

a
undefined

This is due to there actually being a wrapper around all values in the cache, so getOrSet will never be called again, regardless of value.

We should probably define the undefined semantics here. Does setting a value to undefined mean it's empty and then getOrSet should call the setter here? Or should we have an explicit unset api? or should we have both?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions