removeStaleFields

suspend fun NormalizedCache.removeStaleFields(maxAgeProvider: MaxAgeProvider, maxStale: Duration = Duration.ZERO, clock: () -> Long = { currentTimeMillis() }): RemovedFieldsAndRecords

Remove all stale fields in the cache. A field is stale if its received date is older than its max age (configurable via maxAgeProvider) or if its expiration date has passed. A maximum staleness can be passed.

Received dates are stored by calling storeReceivedDate(true) on your ApolloClient.

Expiration dates are stored by calling storeExpirationDate(true) on your ApolloClient.

When all fields of a record are stale, the record itself is removed.

This operation can result in unreachable records, and dangling references.

Return

the fields and records that were removed.


suspend fun ApolloStore.removeStaleFields(maxAgeProvider: MaxAgeProvider, maxStale: Duration = Duration.ZERO): RemovedFieldsAndRecords

Remove all stale fields in the store.

See also