Dispose function is called when the entry is removed from the cache, for any reason, and no longer reachable.
That does mean that calling cache.set(key, value) with a duplicate key will dispose the old value, even if it is the same as the new value. There is no "noDisposeOnSet" option.
Old values will be disposed when they are no longer reachable by both the old and new, so if it's still in the old cache, and you overwrite it, no disposal until the next swap.
Dispose function is called when the entry is removed from the cache, for any reason, and no longer reachable.
That does mean that calling
cache.set(key, value)
with a duplicate key will dispose the old value, even if it is the same as the new value. There is no "noDisposeOnSet" option.Old values will be disposed when they are no longer reachable by both the old and new, so if it's still in the old cache, and you overwrite it, no disposal until the next swap.