Is there any Android Studio plugin or other way to check the content of the Apollo client cache?
I have a GraphQL plugin tab in Android Studio
but I can't find a functionality there to view the cache?
Update: I currently have this plugin but the documentation doesn't mention the cache at all. Seems like I need to fire up the debugger to see the cache content ):
At the moment there isn't any way to see the contents of the cache directly from the IDE, but there is a programmatic way to do so, so you can dump its contents in the logs:
val dump = apolloClient.apolloStore.dump()
Log.d(TAG, NormalizedCache.prettifyDump(dump))
Here's an example of the results:
OptimisticCache {}
MemoryCache {
"User:42" : {
"id" : 42
"name" : name
"email" : email
"__typename" : User
}
"User:43" : {
"id" : 43
"name" : name
"email" : email
"__typename" : User
}
"QUERY_ROOT" : {
"users" : [
CacheKey(User:42)
CacheKey(User:43)
]
}
}
SqlNormalizedCache {
"User:42" : {
"id" : 42
"name" : name
"email" : email
"__typename" : User
}
"User:43" : {
"id" : 43
"name" : name
"email" : email
"__typename" : User
}
"QUERY_ROOT" : {
"users" : [
CacheKey(User:42)
CacheKey(User:43)
]
}
}