class LRUCache [ Key, Value ]

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.

Constructors

LRUCache ( )
LRUCache ( implicit evidence$1: ClassTag [ Key ] , evidence$2: ClassTag [ Value ] )

Members

private implicit val evidence$1 : ClassTag [ Key ]
private implicit val evidence$2 : ClassTag [ Value ]
val keys : Array [ Key ]
var last : Int
var lastButOne : Int
val values : Array [ Value ]
[+] def enter ( key: Key , value: Value ) : Unit

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

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.

def first : Int
def indices : Iterator [ Int ]
def invalidate ( key: Key ) : Unit

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

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

def keysIterator : Iterator [ Key ]
def lastButOne_= ( x$1: Int ) : Unit
def last_= ( x$1: Int ) : Unit
def lookup ( key: Key ) : Value

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.

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.

def next_= ( x$1: SixteenNibbles ) : Unit
override def toString : String