Class CacheAndNetworkFetcher

  • All Implemented Interfaces:
    ResponseFetcher

    public final class CacheAndNetworkFetcher
    extends java.lang.Object
    implements ResponseFetcher
    Signal the apollo client to fetch the data from both the network and the cache. If cached data is not present, only network data will be returned. If cached data is available, but network experiences an error, cached data is returned. If cache data is not available, and network data is not available, the error of the network request will be propagated. If both network and cache are available, both will be returned. Cache data is guaranteed to be returned first.
    • Constructor Detail

      • CacheAndNetworkFetcher

        public CacheAndNetworkFetcher()
    • Method Detail

      • provideInterceptor

        public ApolloInterceptor provideInterceptor​(com.apollographql.apollo.api.internal.ApolloLogger apolloLogger)
        Specified by:
        provideInterceptor in interface ResponseFetcher
        Parameters:
        apolloLogger - A ApolloLogger to log relevant fetch information.
        Returns:
        The ApolloInterceptor that executes the fetch logic.