class LruMap[TKey, TValue] extends LruMapLike[TKey, TValue]
Class defining a map with limited capacity that uses an LRU (least recently used) algorithm for automatic eviction. The primary use case is for caches that need to be limited in size while still maintaining good performance. The map is thread safe.
- TKey
The type of the map keys.
- TValue
The type of the map values.
- Alphabetic
- By Inheritance
- LruMap
- LruMapLike
- BoundedMapLike
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
LruMap(capacity: Int, valueCleanUp: Option[(TValue) ⇒ Unit] = None)
- capacity
The maximum capacity of the map.
- valueCleanUp
A method to run when a value is evicted. Used to trigger additional clean-up logic.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
attachNode(entry: Entry[TKey, TValue]): Entry[TKey, TValue]
- Attributes
- protected
- Definition Classes
- LruMapLike
-
val
cacheSize: AtomicInteger
- Attributes
- protected
- Definition Classes
- BoundedMapLike
-
val
capacity: Int
- Definition Classes
- LruMap → BoundedMapLike
-
def
cleanUp(): Unit
- Attributes
- protected
- Definition Classes
- LruMapLike
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
get(key: TKey): Option[TValue]
Get the value associated with a given key, if available
Get the value associated with a given key, if available
- key
The key for the value.
- Definition Classes
- LruMap → LruMapLike
-
def
getCacheSize: Int
- Definition Classes
- BoundedMapLike
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
getMisses: Long
- Definition Classes
- BoundedMapLike
-
def
getOrAdd(key: TKey)(action: ⇒ TValue): TValue
Get the value associated with a given key, if available, and compute and add it if not.
Get the value associated with a given key, if available, and compute and add it if not.
- key
The key for the value.
- action
A function to compute the value.
- Definition Classes
- LruMap → LruMapLike
-
def
getQueueSize: Int
- Definition Classes
- BoundedMapLike
-
def
getRequests: Long
- Definition Classes
- BoundedMapLike
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
keySet: Set[TKey]
- Attributes
- protected
- Definition Classes
- LruMap → LruMapLike
-
val
lock: AnyRef
- Attributes
- protected
- Definition Classes
- BoundedMapLike
-
val
misses: AtomicLong
- Attributes
- protected
- Definition Classes
- BoundedMapLike
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
poll(): Option[(TKey, TValue)]
- Attributes
- protected
- Definition Classes
- LruMapLike
-
def
purge(): Unit
- Definition Classes
- LruMapLike → BoundedMapLike
-
val
queue: ConcurrentLinkedQueue[LruNode[TKey, TValue]]
- Attributes
- protected
- Definition Classes
- LruMapLike
-
val
queueSize: AtomicInteger
- Attributes
- protected
- Definition Classes
- BoundedMapLike
- def registerAs(id: String, environment: String): LruMap[TKey, TValue]
-
def
remove(key: TKey): Int
Remove the value associated with a given key.
Remove the value associated with a given key.
- key
The key for the value.
- returns
The number of values removed (0 or 1).
- Definition Classes
- LruMap → LruMapLike
-
val
requests: AtomicLong
- Attributes
- protected
- Definition Classes
- BoundedMapLike
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated