Class ApolloCacheInterceptor
- java.lang.Object
-
- com.apollographql.apollo.internal.interceptor.ApolloCacheInterceptor
-
- All Implemented Interfaces:
ApolloInterceptor
public final class ApolloCacheInterceptor extends java.lang.Object implements ApolloInterceptor
ApolloCacheInterceptor is a concreteApolloInterceptorresponsible for serving requests from the normalized cache ifApolloInterceptor.InterceptorRequest.fetchFromCacheis true. Saves all network responses to cache.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.apollographql.apollo.interceptor.ApolloInterceptor
ApolloInterceptor.CallBack, ApolloInterceptor.FetchSourceType, ApolloInterceptor.InterceptorRequest, ApolloInterceptor.InterceptorResponse
-
-
Constructor Summary
Constructors Constructor Description ApolloCacheInterceptor(com.apollographql.apollo.cache.normalized.ApolloStore apolloStore, com.apollographql.apollo.api.internal.ResponseFieldMapper responseFieldMapper, java.util.concurrent.Executor dispatcher, com.apollographql.apollo.api.internal.ApolloLogger logger, boolean writeToCacheAsynchronously)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Disposes of the resources which are no longer required.voidinterceptAsync(ApolloInterceptor.InterceptorRequest request, ApolloInterceptorChain chain, java.util.concurrent.Executor dispatcher, ApolloInterceptor.CallBack callBack)Intercepts the outgoing request and performs non blocking operations on the request or the response returned by the next set of interceptors in the chain.
-
-
-
Constructor Detail
-
ApolloCacheInterceptor
public ApolloCacheInterceptor(@NotNull com.apollographql.apollo.cache.normalized.ApolloStore apolloStore, @NotNull com.apollographql.apollo.api.internal.ResponseFieldMapper responseFieldMapper, @NotNull java.util.concurrent.Executor dispatcher, @NotNull com.apollographql.apollo.api.internal.ApolloLogger logger, boolean writeToCacheAsynchronously)
-
-
Method Detail
-
interceptAsync
public void interceptAsync(@NotNull ApolloInterceptor.InterceptorRequest request, @NotNull ApolloInterceptorChain chain, @NotNull java.util.concurrent.Executor dispatcher, @NotNull ApolloInterceptor.CallBack callBack)Description copied from interface:ApolloInterceptorIntercepts the outgoing request and performs non blocking operations on the request or the response returned by the next set of interceptors in the chain.- Specified by:
interceptAsyncin interfaceApolloInterceptor- Parameters:
request- outgoing request object.chain- the ApolloInterceptorChain object containing the next set of interceptors.dispatcher- the Executor which dispatches the non blocking operations on the request/response.callBack- the Callback which will handle the interceptor's response or failure exception.
-
dispose
public void dispose()
Description copied from interface:ApolloInterceptorDisposes of the resources which are no longer required.A use case for this method call would be when an
ApolloCallneeds to be cancelled and resources need to be disposed of.- Specified by:
disposein interfaceApolloInterceptor
-
-