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

Frank Sullivan

09/26/2023, 9:37 PM
Oh yeah one more question. If I had two ApolloClients and I wanted them to share a cache, would it be okay to write a NormalizedCacheFactory that always returns the same instance? Or would that have undesirable consequences?
I always have the weirdest questions
😂 1
m

mbonnin

09/26/2023, 9:38 PM
That wouldn't work cause the locking is in
ApolloStore
Or you would have to make your
NormalizedCacheFactory
thread safe itself but then you'd pay twice the locking price
May I ask the use case?
f

Frank Sullivan

09/26/2023, 9:42 PM
We have a few client instances at the moment, but I'm not entirely sure why. We were using our own client, based on OkHttp, which was originally written several years ago. Now I'm going through the process of replacing them with ApolloClients, and I'm trying to think if it'd be easier to combine them into one client or to share a cache among several clients.
a

agrosner

09/26/2023, 9:45 PM
We use different client combinations for memory, disk and memory, and no cache in our app with no issues. They share same DI instance . We don’t mix calling them together on same page at once in different strategies too often, but seemingly works fine.
f

Frank Sullivan

09/27/2023, 2:02 PM
Nice, I like that idea
2 Views