Packages

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.

Linear Supertypes
LruMapLike[TKey, TValue], BoundedMapLike, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LruMap
  2. LruMapLike
  3. BoundedMapLike
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. 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

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def attachNode(entry: Entry[TKey, TValue]): Entry[TKey, TValue]
    Attributes
    protected
    Definition Classes
    LruMapLike
  6. val cacheSize: AtomicInteger
    Attributes
    protected
    Definition Classes
    BoundedMapLike
  7. val capacity: Int
    Definition Classes
    LruMapBoundedMapLike
  8. def cleanUp(): Unit
    Attributes
    protected
    Definition Classes
    LruMapLike
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  12. 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
    LruMapLruMapLike
  13. def getCacheSize: Int
    Definition Classes
    BoundedMapLike
  14. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. def getMisses: Long
    Definition Classes
    BoundedMapLike
  16. 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
    LruMapLruMapLike
  17. def getQueueSize: Int
    Definition Classes
    BoundedMapLike
  18. def getRequests: Long
    Definition Classes
    BoundedMapLike
  19. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  20. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  21. def keySet: Set[TKey]
    Attributes
    protected
    Definition Classes
    LruMapLruMapLike
  22. val lock: AnyRef
    Attributes
    protected
    Definition Classes
    BoundedMapLike
  23. val misses: AtomicLong
    Attributes
    protected
    Definition Classes
    BoundedMapLike
  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  27. def poll(): Option[(TKey, TValue)]
    Attributes
    protected
    Definition Classes
    LruMapLike
  28. def purge(): Unit
    Definition Classes
    LruMapLikeBoundedMapLike
  29. val queue: ConcurrentLinkedQueue[LruNode[TKey, TValue]]
    Attributes
    protected
    Definition Classes
    LruMapLike
  30. val queueSize: AtomicInteger
    Attributes
    protected
    Definition Classes
    BoundedMapLike
  31. def registerAs(id: String, environment: String): LruMap[TKey, TValue]
  32. 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
    LruMapLruMapLike
  33. val requests: AtomicLong
    Attributes
    protected
    Definition Classes
    BoundedMapLike
  34. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  35. def toString(): String
    Definition Classes
    AnyRef → Any
  36. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  38. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from LruMapLike[TKey, TValue]

Inherited from BoundedMapLike

Inherited from AnyRef

Inherited from Any

Ungrouped