Package akka.remote.artery
Class LruBoundedCache<K,V>
- java.lang.Object
-
- akka.remote.artery.LruBoundedCache<K,V>
-
- Direct Known Subclasses:
ActorRefResolveCache
,ActorRefResolveCacheWithAddress
,SerializationFormatCache
public abstract class LruBoundedCache<K,V> extends java.lang.Object
INTERNAL APIThis class is based on a Robin-Hood hashmap (http://www.sebastiansylvan.com/post/robin-hood-hashing-should-be-your-default-hash-table-implementation/) with backshift (http://codecapsule.com/2013/11/17/robin-hood-hashing-backward-shift-deletion/).
The main modification compared to an RH hashmap is that it never grows the map (no rehashes) instead it is allowed to kick out entires that are considered old. The implementation tries to keep the map close to full, only evicting old entries when needed.
-
-
Constructor Summary
Constructors Constructor Description LruBoundedCache(int capacity, int evictAgeThreshold, scala.reflect.ClassTag<K> evidence$1, scala.reflect.ClassTag<V> evidence$2)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract V
compute(K k)
scala.Option<V>
get(K k)
V
getOrCompute(K k)
protected abstract int
hash(K k)
protected abstract boolean
isCacheable(V v)
protected int
probeDistanceOf(int idealSlot, int actualSlot)
CacheStatistics
stats()
java.lang.String
toString()
-
-
-
Method Detail
-
hash
protected abstract int hash(K k)
-
isCacheable
protected abstract boolean isCacheable(V v)
-
probeDistanceOf
protected int probeDistanceOf(int idealSlot, int actualSlot)
-
stats
public final CacheStatistics stats()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-