Had a snippet that looked like this ```apolloClien...
# apollo-kotlin
s
Had a snippet that looked like this
Copy code
apolloClient.clearHttpCache()
apolloClient.clearNormalizedCache(
  object : ApolloStoreOperation.Callback<Boolean> { ... },
)
And I see that there is an alternative for the normalizedCache with
apolloClient.apolloStore.clearAll()
as shown by the annotation, but can’t see something for
clearHttpCache
. Is it part of something else? Something else I’m missing?
m
You're not missing anything. This didn't make it to 3.x. For the time being, you can do this:
Copy code
fun ApolloClient.clearHttpCache() {
  val httpNetworkTransport = networkTransport as? HttpNetworkTransport ?: error("cannot get the HttpCache, networkTransport is not a HttpNetworkTransport")
  val cachingHttpInterceptor = httpNetworkTransport.interceptors.firstOrNull { it is CachingHttpInterceptor }
    ?: error("no http cache configured")

  (cachingHttpInterceptor as CachingHttpInterceptor).delete()
}
🙌 1
s
Awesome, thank you!