LRUCache<K, V> class

A simple LRU (Least Recently Used) cache implementation

Constructors

LRUCache.new(int _capacity)
Creates a new LRU cache with the given capacity

Properties

entries Iterable<MapEntry<K, V>>
Returns all entries in the cache
no setter
hashCode int
The hash code for this object.
no setterinherited
keys Iterable<K>
Returns all keys in the cache
no setter
length int
Returns the number of items in the cache
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
values Iterable<V>
Returns all values in the cache
no setter

Methods

clear() → void
Clears the cache
containsKey(K key) bool
Returns true if the cache contains the key
get(K key) → V?
Gets a value from the cache Returns null if the key is not in the cache
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(K key, V value) → void
Puts a value in the cache If the cache is full, removes the least recently used item
remove(K key) → void
Removes a key from the cache
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited