Trimming the cache
By default, if you don't use expiration and garbage collection, the cache will grow indefinitely as more data is written to it.
To prevent this, a few APIs are available:
ApolloStore.clearAll(): clear the entire cache.ApolloStore.remove(): remove specific records.ApolloStore.removeOperation()andApolloStore.removeFragment(): remove the records associated to specific operations or fragments.ApolloStore.trim(): trim the cache by a specified amount (by default 10%) if it exceeds a certain size. The oldest (according to their updated date) records are removed.
Last modified: 06 August 2025