SharedMapCached<K, V> class

Cached version of a SharedMap.

Implemented types
Available Extensions

Constructors

SharedMapCached(SharedMap<K, V> _sharedMap, {Duration? timeout = defaultTimeout})

Properties

cachedEntries Map<K, V>
no setter
hashCode int
The hash code for this object.
no setterinherited
id String
The ID of the referenceable instance.
no setteroverride
onAbsent SharedMapKeyCallback<K, V>?
Optional callback for when an entry is accessed and is absent.
getter/setter pairoverride
onInitialize SharedMapEventCallback?
Optional callback for when the SharedMap instance is initialized.
getter/setter pairoverride
onPut SharedMapEntryCallback<K, V>?
Optional callback for when put is called.
getter/setter pairoverride
onRemove SharedMapEntryCallback<K, V>?
Optional callback for when remove is called.
getter/setter pairoverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sharedStore SharedStore
The SharedStore where this instance is stored/handled.
no setteroverride
timeout Duration
The default timeout of the cached entries.
final

Methods

cached({Duration? timeout}) SharedMapCached<K, V>
Returns a cached version of this instance.
override
clear() FutureOr<int>
Clears all the entries and returns the amount of removed entries.
override
clearCache() → void
entries({Duration? timeout, bool refresh = false}) FutureOr<List<MapEntry<K, V>>>
Returns all the entries.
override
get(K key, {Duration? timeout, bool refresh = false}) FutureOr<V?>
Returns the value of key.
override
keys({Duration? timeout, bool refresh = false}) FutureOr<List<K>>
Returns all the keys.
override
length({Duration? timeout, bool refresh = false}) FutureOr<int>
Returns keys length.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(K key, V? value) FutureOr<V?>
Sets the value of key and returns it.
override
putIfAbsent(K key, V? absentValue) FutureOr<V?>
Sets the absentValue of key if it's null, and returns it. If the key value is already define and is NOT null, returns the previous value.
override
remove(K key) FutureOr<V?>
Remove the key entry and return the removed value.
override
removeAll(List<K> keys) FutureOr<List<V?>>
Remove the keys entries and return the removed values.
override
setCallbacks({SharedMapEventCallback? onInitialize, SharedMapKeyCallback<K, V>? onAbsent, SharedMapEntryCallback<K, V>? onPut, SharedMapEntryCallback<K, V>? onRemove}) → void
override
setCallbacksDynamic<K1, V1>({SharedMapEventCallback? onInitialize, SharedMapKeyCallback<K1, V1>? onAbsent, SharedMapEntryCallback<K1, V1>? onPut, SharedMapEntryCallback<K1, V1>? onRemove}) → void
override
sharedReference() SharedMapReference
Returns the SharedReference of this instances, to instantiate it using a fromSharedReference constructor.
override
toString() String
A string representation of this object.
override
update(K key, SharedMapUpdater<K, V> updater) FutureOr<V?>
Updated the key value by running the updater code in the same memory context (Isolate) as the main instance.
override
values({Duration? timeout, bool refresh = false}) FutureOr<List<V>>
Returns all the values.
override
where(bool test(K key, V value)) FutureOr<List<MapEntry<K, V>>>
Returns all the entries that satisfy the predicate test.
override

Operators

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

Constants

defaultTimeout → const Duration
The default cache timeout (1 sec).