-
Hi, super thank for this great library, I have to question about the API design.
Thank you, and have a nice day. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
A cache removal is usually called an invalidation so we have
Yes, an unbounded cache is a thin wrapper to conform to our interfaces. The benchmark's difference is that in Java 8's You can read Doug's reasoning, where he relented for Java 9 by adding a partial pre-screening if the desired entry is at the head of the hashbin. That somewhat reduces the chance of blocking but doesn't resolve the performance issue. I believe with the removal of biased locking and reduction of safepoints in favor of thread-local handshakes that his concerns no longer true. You could email him if interested in having him revisit that design choice for future JDKs. Last I talked with him he was thinking about redesigning for per-entry locking for computes instead of the hashbin, so it's reasonable timing. |
Beta Was this translation helpful? Give feedback.
-
Sorry, I forgot to mention of Q1, Ideally we want to promote loading through the cache and not using |
Beta Was this translation helpful? Give feedback.
A cache removal is usually called an invalidation so we have
Cache.invalidate(key)
. This is avoid
method because best practice is to not rely or assume anything about the current contents of the cache and treat it as a transparent, transient storage layer. That makes theCache
interface opinionated. However, options or best practices shouldn't stop a developer from solving their problems, so we have theasMap()
view for the familiar Collections interfaces. AMap
is typically a passive data structure, e.g. it isn't changing underneath you, whereas aCache
is an ac…