- All Implemented Interfaces:
- java.util.Map<K,V>
public class FastCache<K,V>
extends java.util.AbstractMap<K,V>
A cache intended to help speed up access to a Map.
The idea is that some maps have a few values that are retrieved
more frequently than others. So, we create a fixed size array
that holds keys and values, and do a very fast hash on the key's
identityHashCode. The cache is backed by a map, which can be
an IdentityHashMap, or any other map (such as a WeakHashMap)
where the keys satisfy k1.equals(k2) implies k1 == k2.
Note that all put operations MUST go through this class,
because calling put on the underlying map can result in
the cache returning incorrect results for get.