SimpleStorage<K, V> class

A simple storage class which is backed by a LinkedHashMap internally

Implemented types
Implementers

Constructors

SimpleStorage({OnEvict<K, V>? onEvict})

Properties

entries List<CacheEntry<K, V>>
Returns the available values. This violates the enclosing principle. Take the return values with caution
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
keys List<K>
Returns the available keys. This violates the enclosing principle. Take the return values with caution
no setteroverride
length int
Returns the approx number of items in the cache. Take this with a grain of salt
no setteroverride
onEvict OnEvict<K, V>?
if onEvict is set that method is called whenever an entry is removed from the cache. At the time the method is called the entry is already removed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Clears the cache, evicts all entries
override
containsKey(K key) bool
returns true if the item is available in the cache. Take this with a grain of salt since the item may be evicted before it will be retrieved. It is better to use get and check for null returns.
override
get(K key) CacheEntry<K, V>?
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onCapacity(K key) CacheEntry<K, V>?
removes the entry denoted by key. This is called if the capacity is reached.
override
onEvictInternal(K key, V value) → dynamic
remove(K key) CacheEntry<K, V>?
removes the entry at position key. Returns the entry or null. Note that the entry is already evicted.
override
removeInternal(K key) CacheEntry<K, V>?
override
set(K key, CacheEntry<K, V> value) Storage
override
setInternal(K key, CacheEntry<K, V> value) → void
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](K key) CacheEntry<K, V>?
Same as get
override
operator []=(K key, CacheEntry<K, V> value) → void
Same as set
override