diff --git a/Writerside/topics/garbage-collection.md b/Writerside/topics/garbage-collection.md index f86d00ef..14c7451e 100644 --- a/Writerside/topics/garbage-collection.md +++ b/Writerside/topics/garbage-collection.md @@ -9,7 +9,7 @@ A field is considered stale if its **received date** is older than its (client c See [](cache-control.md) for more information about staleness. -Stale fields can be removed from the cache by calling the `ApolloStore.removeStaleFields` function. +Stale fields can be removed from the cache by calling the [`ApolloStore.removeStaleFields()`](https://apollographql.github.io/apollo-kotlin-normalized-cache-incubating/kdoc/normalized-cache-incubating/com.apollographql.cache.normalized/remove-stale-fields.html) function. If all fields of a record are stale, the record itself is removed. @@ -23,7 +23,7 @@ This can happen when: - manually deleting records with [`ApolloStore.remove()`](https://apollographql.github.io/apollo-kotlin-normalized-cache-incubating/kdoc/normalized-cache-incubating/com.apollographql.cache.normalized/-apollo-store/remove.html) - records get deleted because all their fields are [stale](#stale-fields) -Dangling references can be removed from the cache by calling the `ApolloStore.removeDanglingReferences` function. +Dangling references can be removed from the cache by calling the [`ApolloStore.removeDanglingReferences()`](https://apollographql.github.io/apollo-kotlin-normalized-cache-incubating/kdoc/normalized-cache-incubating/com.apollographql.cache.normalized/remove-dangling-references.html) function. If all fields of a record are dangling references, the record itself is removed. @@ -35,12 +35,13 @@ Note: if a field's value is a list for which one or more elements are dangling r A record is **unreachable** if there exists no chain of references from the root record to it. This can happen when: +- data that was previously returned by the server is no longer returned by a subsequent query - manually adding records with [`ApolloStore.writeFragment()`](https://apollographql.github.io/apollo-kotlin-normalized-cache-incubating/kdoc/normalized-cache-incubating/com.apollographql.cache.normalized/-apollo-store/write-fragment.html) - manually deleting records with [`ApolloStore.remove()`](https://apollographql.github.io/apollo-kotlin-normalized-cache-incubating/kdoc/normalized-cache-incubating/com.apollographql.cache.normalized/-apollo-store/remove.html) and `cascade = false`: the deleted record could be the only one referencing others - references get deleted because they're [stale](#stale-fields) -Unreachable records can be removed from the cache by calling the `ApolloStore.removeUnreachableRecords` function. +Unreachable records can be removed from the cache by calling the [`ApolloStore.removeUnreachableRecords()`](https://apollographql.github.io/apollo-kotlin-normalized-cache-incubating/kdoc/normalized-cache-incubating/com.apollographql.cache.normalized/remove-unreachable-records.html) function. ## `ApolloStore.garbageCollect()` -The `ApolloStore.garbageCollect()` function is a convenience to remove all stale fields, dangling references, and unreachable records from the cache. +The [`ApolloStore.garbageCollect()`](https://apollographql.github.io/apollo-kotlin-normalized-cache-incubating/kdoc/normalized-cache-incubating/com.apollographql.cache.normalized/garbage-collect.html) function is a convenience to remove all stale fields, dangling references, and unreachable records from the cache.