StatisticsStorage<K, V> class
Same as SimpleStorage but collects a few statistical data. The statistics can be retrieved by calling toString
- Inheritance
-
- Object
- SimpleStorage<
K, V> - StatisticsStorage
Constructors
-
StatisticsStorage({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 setterinherited
- 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 setterinherited
- length → int
-
Returns the approx number of items in the cache. Take this with a grain
of salt
no setterinherited
-
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.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void -
Clears the cache, evicts all entries
inherited
-
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 -
override
-
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> ? -
inherited
-
set(
K key, CacheEntry< K, V> value) → Storage -
inherited
-
setInternal(
K key, CacheEntry< K, V> value) → void -
override
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
K key) → CacheEntry< K, V> ? -
Same as get
inherited
-
operator []=(
K key, CacheEntry< K, V> value) → void -
Same as set
inherited