https://kotlinlang.org logo
#apollo-kotlin
Title
# apollo-kotlin
a

agrosner

06/28/2022, 5:29 PM
Based on the documentation for http cache,
HttpFetchPolicy
. It is not clear to me whether the http cache has an option for both cache and network both times (cache first, then hit network) . does the
CacheFirst
option enable hitting both everytime? the normalized cache supports
CacheAndNetwork
or would it require me to use the normalized cache instead?
m

mbonnin

06/28/2022, 7:04 PM
The normalized cache
CacheAndNetwork
was added after the fact and it hasn't been implemented for the HTTP cache indeed
Can you open an issue?
a

agrosner

06/29/2022, 2:31 PM
sure thing!
🙏 1
i think this is descriptive enough, but obvs if you need clarification I can update it
m

mbonnin

06/29/2022, 2:43 PM
That's perfect, thanks!
Only caveat is whatever solution we come up with won't be
.watch()
as
.watch()
is really only possible with the normalized cache
Until there is a
HttpFetchPolicy.CacheAndNetwork
, I think you can relatively easily make an extension function that "bundles" 2 calls and returns a
Flow
a

agrosner

06/29/2022, 2:45 PM
🥳 alright. ill try it out, worst case scenario is that it hits the network twice, correct?
m

mbonnin

06/29/2022, 2:46 PM
If you do the first one
CacheOnly
, there's no reason it hits the network twice
a

agrosner

06/29/2022, 2:55 PM
oh right!!
6 Views