JsonCacheMem class final
Thread-safe in-memory JsonCache decorator.
It is a kind of level 1 cache.
It encapsulates a slower cache and keeps its own data in-memory.
- Implemented types
Constructors
- JsonCacheMem([JsonCache? level2])
- In-memory level 1 cache with an optional level 2 instance.
-
JsonCacheMem.init(Map<
String, Map< initData, {JsonCache? level2, OnInitError? onInitError})String, dynamic> ?> -
Initializes both the internal memory (level 1 cache) and the local storage
of the user's device (level 2 cache —
level2
) with the contents ofinitData
. -
JsonCacheMem.mem(Map<
String, Map< mem, {JsonCache? level2, ReadWriteMutex? mutex})String, dynamic> ?> - Cache with an external memory and an optional custom mutex.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → Future< void> -
Frees up storage space in both the level2 cache and in-memory cache.
override
-
contains(
String key) → Future< bool> -
Checks whether the in-memory or the level 2 cache contains cached data
at
key
.override -
keys(
) → Future< UnmodifiableListView< String> > -
The cache keys.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refresh(
String key, Map< String, dynamic> data) → Future<void> -
Updates the data located at
key
in both the level 2 cache and in-memory cache.override -
remove(
String key) → Future< void> -
Removes the cached value located at
key
from both the level 2 cache and in-memory cache.override -
toString(
) → String -
A string representation of this object.
inherited
-
value(
String key) → Future< Map< String, dynamic> ?> -
Retrieves the value at
key
ornull
if there is no data.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited