LruCache<K, V> class
Least recently used cache. Items which are not read for the longest period gets evicted first
Properties
- capacity → int
-
The maximum capacity of the cache. When more values will be added to the
cache the least "desired" values will be removed. "desired" values are
determined by the type of the cache. For example the lruCache will evict
the item wich was not used for the longest time.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- lastUse ↔ int
-
getter/setter pair
- length → int
-
return the number of element in the cache
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
storage
→ Storage<
K, V> -
finalinherited
Methods
-
beforeGet(
CacheEntry< K, V> entry) → CacheEntry<K, V> ? - Process the entry found in the storage before returning it. If this method returns null the entry is considered as expired and will not be returned to the caller.
-
clear(
) → void -
remove all the entry inside the cache
inherited
-
containsKey(
K key) → bool -
Check if the cache contains a specific entry. It is better to use get and
check for null-returns
inherited
-
createCacheEntry(
K key, V element) → CacheEntry< K, V> - internal set
-
get(
K key) → V? -
return the element identified by
key
inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onCapacity(
K key, V element) → void -
called if we want to
insert another item denoted by
key
andelement
into the map. This method checks if the capacity is reached and eventually evicts old items. -
remove(
K key) → V? -
Removes an entry from the cache. Returns null if the entry was not found.
Note that the entry which may be returned is already evicted.
inherited
-
set(
K key, V element) → void -
add
element
in the cache atkey
inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
K key) → dynamic -
return the value at
key
. Same as getinherited -
operator []=(
K key, V element) → void -
assign
element
forkey
. Same as setinherited