Cache class
Constructors
-
Cache({Store? store, DataIdResolver? dataIdFromObject, Map<String, TypePolicy> typePolicies = const {}, Map<String, Set<String>> possibleTypes = const {}, bool addTypename = true, Map<OperationRequest, Map<String, Map<String, dynamic>?>> seedOptimisticPatches = const {}, JsonEquals? jsonEquals})
-
Methods
-
clear()
→ void
-
Removes all data from the store and from any optimistic patches.
-
clearOptimisticPatches()
→ void
-
removes all optimistic patches
-
dispose()
→ Future<void>
-
-
evict(String entityId, {String? fieldName, Map<String, dynamic> args = const {}, OperationRequest? optimisticRequest})
→ void
-
Removes the entity from the Store as well as from any optimistic
patches.
-
gc()
→ Set<String>
-
Removes all entities that cannot be reached from one of the root operations.
-
identify<TData>(TData data)
→ String?
-
Returns the canonical ID for a given object or reference.
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
optimisticReader(String dataId)
→ Map<String, dynamic>?
-
Reads data for the given
dataId
from the Store, merging in any data from optimistic patches
-
readFragment<TData, TVars>(FragmentRequest<TData, TVars> request, {bool optimistic = true})
→ TData?
-
Reads denormalized data from the Cache for the given fragment.
-
readQuery<TData, TVars>(OperationRequest<TData, TVars> request, {bool optimistic = true})
→ TData?
-
Reads denormalized data from the Cache for the given operation.
-
release(String entityId)
→ void
-
Allows the entity to be garbage collected if it no longer has any
references.
-
removeOptimisticPatch(OperationRequest request)
→ void
-
-
retain(String entityId)
→ void
-
Prevents the entity from being garbage collected.
-
toString()
→ String
-
A string representation of this object.
inherited
-
watchFragment<TData, TVars>(FragmentRequest<TData, TVars> request, {bool optimistic = true})
→ Stream<TData?>
-
Watches for changes to data in the Cache for the given fragment.
-
watchQuery<TData, TVars>(OperationRequest<TData, TVars> request, {bool optimistic = true})
→ Stream<TData?>
-
Watches for changes to data in the Cache for the given operation.
-
writeFragment<TData, TVars>(FragmentRequest<TData, TVars> request, TData data, {OperationRequest? optimisticRequest})
→ void
-
Normalizes
data
for the given fragment and writes it to the Store.
-
writeQuery<TData, TVars>(OperationRequest<TData, TVars> request, TData data, {OperationRequest? optimisticRequest})
→ void
-
Normalizes
data
for the given operation and writes it to the Store.