public final class RealApolloStore extends java.lang.Object implements ApolloStore, ReadableStore, WriteableStore
ApolloStore.RecordChangeSubscriberNO_APOLLO_STORE| Constructor and Description |
|---|
RealApolloStore(NormalizedCache normalizedCache,
CacheKeyResolver cacheKeyResolver,
java.util.Map<com.apollographql.apollo.api.ScalarType,CustomTypeAdapter> customTypeAdapters,
ApolloLogger logger) |
| Modifier and Type | Method and Description |
|---|---|
CacheKeyResolver |
cacheKeyResolver() |
ResponseNormalizer<Record> |
cacheResponseNormalizer() |
void |
clearAll()
Clear all records from this
ApolloStore. |
java.util.Set<java.lang.String> |
merge(java.util.Collection<Record> recordSet,
CacheHeaders cacheHeaders) |
ResponseNormalizer<java.util.Map<java.lang.String,java.lang.Object>> |
networkResponseNormalizer() |
NormalizedCache |
normalizedCache() |
void |
publish(java.util.Set<java.lang.String> changedKeys) |
java.util.Collection<Record> |
read(java.util.Collection<java.lang.String> keys,
CacheHeaders cacheHeaders) |
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
read(com.apollographql.apollo.api.Operation<D,T,V> operation)
Read GraphQL operation from store.
|
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
read(com.apollographql.apollo.api.Operation<D,T,V> operation,
com.apollographql.apollo.api.ResponseFieldMapper<D> responseFieldMapper,
ResponseNormalizer<Record> responseNormalizer,
CacheHeaders cacheHeaders)
Read GraphQL operation response from store.
|
<F extends com.apollographql.apollo.api.GraphqlFragment> |
read(com.apollographql.apollo.api.ResponseFieldMapper<F> responseFieldMapper,
CacheKey cacheKey,
com.apollographql.apollo.api.Operation.Variables variables)
Read GraphQL fragment from store.
|
Record |
read(java.lang.String key,
CacheHeaders cacheHeaders) |
<R> R |
readTransaction(Transaction<ReadableStore,R> transaction)
Run a operation inside a read-lock.
|
void |
subscribe(ApolloStore.RecordChangeSubscriber subscriber) |
void |
unsubscribe(ApolloStore.RecordChangeSubscriber subscriber) |
<R> R |
writeTransaction(Transaction<WriteableStore,R> transaction)
Run a operation inside a write-lock.
|
public RealApolloStore(@Nonnull
NormalizedCache normalizedCache,
@Nonnull
CacheKeyResolver cacheKeyResolver,
@Nonnull
java.util.Map<com.apollographql.apollo.api.ScalarType,CustomTypeAdapter> customTypeAdapters,
@Nonnull
ApolloLogger logger)
public ResponseNormalizer<java.util.Map<java.lang.String,java.lang.Object>> networkResponseNormalizer()
networkResponseNormalizer in interface ApolloStoreResponseNormalizer used to generate normalized records from the network.public ResponseNormalizer<Record> cacheResponseNormalizer()
cacheResponseNormalizer in interface ApolloStoreResponseNormalizer used to generate normalized records from the cache.public void subscribe(ApolloStore.RecordChangeSubscriber subscriber)
subscribe in interface ApolloStorepublic void unsubscribe(ApolloStore.RecordChangeSubscriber subscriber)
unsubscribe in interface ApolloStorepublic void publish(@Nonnull
java.util.Set<java.lang.String> changedKeys)
publish in interface ApolloStorechangedKeys - A set of keys of Record which have changed.public void clearAll()
ApolloStoreApolloStore.clearAll in interface ApolloStoreclearAll in interface WriteableStorepublic <R> R readTransaction(Transaction<ReadableStore,R> transaction)
ApolloStorereadTransaction in interface ApolloStoreR - The result type of this read operation.transaction - A code block to run once the read lock is acquired.public <R> R writeTransaction(Transaction<WriteableStore,R> transaction)
ApolloStorewriteTransaction in interface ApolloStoreR - The result type of this write operation.transaction - A code block to run once the write lock is acquired.public NormalizedCache normalizedCache()
normalizedCache in interface ApolloStoreNormalizedCache which backs this ApolloStore.@Nullable public Record read(@Nonnull java.lang.String key, @Nonnull CacheHeaders cacheHeaders)
read in interface ReadableStore@Nonnull public java.util.Collection<Record> read(@Nonnull java.util.Collection<java.lang.String> keys, @Nonnull CacheHeaders cacheHeaders)
read in interface ReadableStore@Nonnull
public java.util.Set<java.lang.String> merge(@Nonnull
java.util.Collection<Record> recordSet,
@Nonnull
CacheHeaders cacheHeaders)
merge in interface WriteableStorepublic CacheKeyResolver cacheKeyResolver()
cacheKeyResolver in interface ApolloStoreCacheKeyResolver used for resolving field cache keys@Nullable
public <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> T read(@Nonnull
com.apollographql.apollo.api.Operation<D,T,V> operation)
ApolloStoreread in interface ApolloStoreD - type of GraphQL operation dataT - type operation cached data will be wrapped withV - type of operation variablesoperation - to be read@Nonnull
public <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> com.apollographql.apollo.api.Response<T> read(@Nonnull
com.apollographql.apollo.api.Operation<D,T,V> operation,
@Nonnull
com.apollographql.apollo.api.ResponseFieldMapper<D> responseFieldMapper,
@Nonnull
ResponseNormalizer<Record> responseNormalizer,
@Nonnull
CacheHeaders cacheHeaders)
ApolloStoreread in interface ApolloStoreD - type of GraphQL operation dataT - type operation cached data will be wrapped withV - type of operation variablesoperation - response of which should be readresponseFieldMapper - ResponseFieldMapper to be used for field mappingresponseNormalizer - ResponseNormalizer to be used when reading cached responsecacheHeaders - CacheHeaders to be used when reading cached response@Nullable
public <F extends com.apollographql.apollo.api.GraphqlFragment> F read(@Nonnull
com.apollographql.apollo.api.ResponseFieldMapper<F> responseFieldMapper,
@Nonnull
CacheKey cacheKey,
@Nonnull
com.apollographql.apollo.api.Operation.Variables variables)
ApolloStoreread in interface ApolloStoreF - type of fragment to be readresponseFieldMapper - ResponseFieldMapper to be used for field mappingcacheKey - CacheKey to be used to find cache record for the fragmentvariables - Operation.Variables required for fragment arguments resolving