ApolloStore.ReadWriteTransaction
CLASS
ApolloStore.ReadWriteTransaction
1public final class ReadWriteTransaction: ReadTransactionMethods
update(_:_:)
1public func update<CacheMutation: LocalCacheMutation>(
2 _ cacheMutation: CacheMutation,
3 _ body: (inout CacheMutation.Data) throws -> Void
4) throwsupdateObject(ofType:withKey:variables:_:)
1public func updateObject<SelectionSet: ApolloAPI.MutableRootSelectionSet>(
2 ofType type: SelectionSet.Type,
3 withKey key: CacheKey,
4 variables: GraphQLOperation.Variables? = nil,
5 _ body: (inout SelectionSet) throws -> Void
6) throwswrite(data:for:)
1public func write<CacheMutation: LocalCacheMutation>(
2 data: CacheMutation.Data,
3 for cacheMutation: CacheMutation
4) throwswrite(selectionSet:withKey:variables:)
1public func write<SelectionSet: MutableRootSelectionSet>(
2 selectionSet: SelectionSet,
3 withKey key: CacheKey,
4 variables: GraphQLOperation.Variables? = nil
5) throwsremoveObject(for:)
1public func removeObject(for key: CacheKey) throwsRemoves the object for the specified cache key. Does not cascade or allow removal of only certain fields. Does nothing if an object does not exist for the given key.
Parameters:
key: The cache key to remove the object for
Parameters
| Name | Description |
|---|---|
| key | The cache key to remove the object for |
removeObjects(matching:)
1public func removeObjects(matching pattern: CacheKey) throwsRemoves records with keys that match the specified pattern. This method will only remove whole records, it does not perform cascading deletes. This means only the records with matched keys will be removed, and not any references to them. Key matching is case-insensitive.
If you attempt to pass a cache path for a single field, this method will do nothing since it won't be able to locate a record to remove based on that path.
Note: This method can be very slow depending on the number of records in the cache. It is recommended that this method be called in a background queue.
Parameters:
pattern: The pattern that will be applied to find matching keys.
Parameters
| Name | Description |
|---|---|
| pattern | The pattern that will be applied to find matching keys. |