TimedMap<K, V> class
A Map where the keys have a put time (DateTime) and also can expire.
- Implemented types
-
- Available extensions
Methods
-
addAll(Map<K, V> other)
→ void
-
Adds all key/value pairs of
other
to this map.
override
-
addEntries(Iterable<MapEntry<K, V>> newEntries)
→ void
-
Adds all key/value pairs of
newEntries
to this map.
override
-
cast<RK, RV>()
→ Map<RK, RV>
-
Provides a view of this map as having
RK
keys and RV
instances,
if necessary.
override
-
checkAllEntries({DateTime? now, Duration? keyTimeout})
→ int
-
Checks all the entries of this instance.
-
checkEntry(Object? key, {DateTime? now, Duration? keyTimeout})
→ bool
-
Check the
key
entry timeout. Returns true
if the key
expired.
-
clear()
→ void
-
Removes all entries from the map.
override
-
containsKey(Object? key)
→ bool
-
Whether this map contains the given
key
.
override
-
containsValue(Object? value)
→ bool
-
Whether this map contains the given
value
.
override
-
entriesChecked({DateTime? now, Duration? keyTimeout})
→ List<MapEntry<K, V>>
-
Returns the entries of this instance checking
keyTimeout
.
See checkAllEntries.
-
forEach(void action(K key, V value))
→ void
-
Applies
action
to each key/value pair of the map.
override
-
getChecked(K key, {DateTime? now, Duration? keyTimeout})
→ V?
-
Returns a
key
checking keyTimeout
.
-
getElapsedTime(Object? key, {DateTime? now})
→ Duration?
-
Returns the elapsed time of
key
, since the put.
-
getTime(Object? key)
→ DateTime?
-
Returns the time (DateTime) of a
key
.
-
isEntryExpired(Object? key, {DateTime? now, Duration? keyTimeout})
→ bool
-
Returns
true
if the key
entry is expired (reached the timeout).
-
keysChecked({DateTime? now, Duration? keyTimeout})
→ List<K>
-
Returns the keys of this instance checking
keyTimeout
.
See checkAllEntries.
-
map<K2, V2>(MapEntry<K2, V2> convert(K key, V value))
→ TimedMap<K2, V2>
-
Returns a new map where all entries of this map are transformed by
the given
convert
function.
override
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
put(K key, V value, {DateTime? now})
→ void
-
Sets a
key
value
.
-
putIfAbsent(K key, V ifAbsent())
→ V
-
Look up the value of
key
, or add a new entry if it isn't there.
override
-
putIfAbsentChecked(K key, V ifAbsent(), {DateTime? now, Duration? keyTimeout})
→ V
-
Same as putIfAbsent, but calls checkEntry first.
-
putIfAbsentCheckedAsync(K key, FutureOr<V> ifAbsent(), {DateTime? now, Duration? keyTimeout})
→ FutureOr<V>
-
Same as putIfAbsentChecked, but accepts an async function for
ifAbsent
.
-
remove(Object? key)
→ V?
-
Removes
key
and its associated value, if present, from the map.
override
-
removeWhere(bool test(K key, V value))
→ void
-
Removes keys where
test
returns true
. See removeWhereTimed.
override
-
removeWhereTimed(bool test(K key, V value, DateTime time))
→ void
-
Removes keys where
test
returns true
. See removeWhere.
-
toString()
→ String
-
A string representation of this object.
override
-
update(K key, V update(V value), {V ifAbsent()?})
→ V
-
Updates the value for the provided
key
.
override
-
updateAll(V update(K key, V value))
→ void
-
Updates all values.
override
-
updateAllTimed(V update(K key, V value, DateTime time))
→ void
-
Same as updateAll, but with an extra parameter
time
in function update
.
-
updateTimed(K key, V update(V value), {V ifAbsent()?, DateTime? now, Duration? keyTimeout})
→ V
-
Same as
update
, but calls checkEntry first.
-
valuesChecked({DateTime? now, Duration? keyTimeout})
→ List<V>
-
Returns the values of this instance checking
keyTimeout
.
See checkAllEntries.