Quick normalized cache question. I've been tasked ...
# apollo-kotlin
f
Quick normalized cache question. I've been tasked with reporting some metrics about our network performance. One of the things that they want me to report is cache read/write time. I was able to report cache read times by enabling
emitCacheMisses
(which I think is enabled by default in 4 but we're still on 3.8) and then looking at the timing info in the
cacheInfo
execution context. I haven't yet figured out a way to time cache writes though.
It's not hugely important atm I just want to make sure I exhaust all avenues. I think on the iOS side they have a cache interceptor of some kind that they use.
m
I don't think there is anything at the moment.
Interestingly, iOS models cache read & cache write interceptors as 2 different interceptors (source) while in Kotlin it's just 1 interceptor that wraps the downstream ones
I think I like the current Apollo Kotlin approach because it allows to encapsulate more. For an example, for APQs, the whole logic is in AutoPersistedInterceptor. You can have the read and write portions alongside whereas if your interceptors don't wrap each others, you need 2 different ones kept in sync
f
that's awesome, thank you. Yeah I love the Kotlin design, very easy to follow