dotty.tools.dotc.util

LRUCache

Related Docs: object LRUCache | package util

class LRUCache[Key >: Null <: AnyRef, Value >: Null] extends AnyRef

A least-recently-used cache for Key -> Value computations It currently keeps the last 8 associations, but this can be changed to anywhere between 2 and 16 by changing LRUCache.Retained.

Implementation: We keep a ring of eight places, linked with the next data structure. The ring models a priority queue. last points to the last element of the queue, and next(last) to the first one. Lookups compare keys sequentially from first to last. Elements with successful lookup get promoted to be first in the queue. Elements are evicted at the last position.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. LRUCache
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LRUCache()(implicit arg0: ClassTag[Key], arg1: ClassTag[Value])

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 clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def enter(key: Key, value: Value): Unit

    Enter key/value in cache at position last.

    Enter key/value in cache at position last. As a side effect, sets last to lastButOne. If lastButOne was set by a preceding unsuccessful lookup for the same key, this means that the new element is now the first in the queue. If there was no preceding lookup, the element is inserted at a random position in the queue.

  7. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. def first: Int

  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  13. def indices: Iterator[Int]

  14. def invalidate(key: Key): Unit

    Invalidate key.

    Invalidate key. The invalidated element becomes the last in the queue.

  15. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  16. val keys: Array[Key]

  17. def keysIterator: Iterator[Key]

  18. var last: Int

  19. var lastButOne: Int

  20. def lookup(key: Key): Value

    Lookup key, returning value or null for not found.

    Lookup key, returning value or null for not found. As a side effect, sets lastButOne to the element before last if key was not found.

  21. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  22. var next: SixteenNibbles

  23. final def notify(): Unit

    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  26. def toString(): String

    Definition Classes
    LRUCache → AnyRef → Any
  27. val values: Array[Value]

  28. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped