What is your assumption when if an entry is put into the cache, but
its weight exceeds the cache's capacity? For example, the cache is
bounded to 1MB and a 2MB entry is added.
Currently it is added to the map and an eviction is triggered. As the
entry is the most recently used, its the last potential victim to be
evaluated. The cache continues to evict until the weighted size
doesn't exceed the capacity threshold, which results in flushing the
cache.
While logical, this probably isn't the desired behavior. I suspect
that if the weightedSize > capacity then it should bypass the cache
and immediately be evicted. What is your expectation?
P.S. I added a quick tutorial with an example using your Jamm
library. :)