Package-level declarations

Types

Link copied to clipboard

A collection of cache headers that Apollo's implementations of NormalizedCache respect.

Link copied to clipboard
interface CacheData

Data read from the cache that can be represented as a JSON map.

Link copied to clipboard

A key/value collection which is sent with Record from a Operation to the NormalizedCache.

Link copied to clipboard
class CacheKey(val key: String)

A CacheKey identifies an object in the cache.

Link copied to clipboard

An CacheKeyGenerator is responsible for finding an id for a given object

Link copied to clipboard

The context in which an object is normalized.

Link copied to clipboard

A CacheResolver that resolves objects and list of objects and fallbacks to the default resolver for scalar fields. It is intended to simplify the usage of CacheResolver when no special handling is needed for scalar fields.

Link copied to clipboard
interface CacheResolver

An interface for CacheResolver used to read the cache

Link copied to clipboard

A cache resolver that uses the parent to resolve fields.

Link copied to clipboard

A cache resolver that uses the cache date as an expiration date and expires past it

Link copied to clipboard

A CacheResolver that uses @fieldPolicy annotations to resolve fields and delegates to DefaultCacheResolver else

Link copied to clipboard
class MemoryCache(maxSizeBytes: Int = Int.MAX_VALUE, expireAfterMillis: Long = -1) : NormalizedCache

Memory (multiplatform) cache implementation based on recently used property (LRU).

Link copied to clipboard
class MemoryCacheFactory @JvmOverloads constructor(maxSizeBytes: Int = Int.MAX_VALUE, expireAfterMillis: Long = -1) : NormalizedCacheFactory
Link copied to clipboard

A provider of Record for reading requests from cache.

Link copied to clipboard
abstract class NormalizedCacheFactory

A Factory used to construct an instance of a NormalizedCache configured with the custom scalar adapters set in ApolloClient.Builder#addCustomScalarAdapter(CustomScalarType, Adapter).

Link copied to clipboard
Link copied to clipboard

A cache resolver that uses the cache date as a receive date and expires after a fixed max age

Link copied to clipboard
class Record(val key: String, val fields: Map<String, Any?>, val mutationId: Uuid? = null) : Map<String, Any?>

A normalized entry that corresponds to a response object. Object fields are stored if they are a GraphQL Scalars. If a field is a GraphQL Object a CacheKey will be stored instead.

Link copied to clipboard

A CacheKeyGenerator that uses annotations to compute the id

Functions

Link copied to clipboard
Link copied to clipboard
fun <D : Operation.Data> Operation<D>.normalize(data: D, customScalarAdapters: CustomScalarAdapters, cacheKeyGenerator: CacheKeyGenerator): Map<String, Record>
fun <D : Executable.Data> Executable<D>.normalize(data: D, customScalarAdapters: CustomScalarAdapters, cacheKeyGenerator: CacheKeyGenerator, rootKey: String): Map<String, Record>
Link copied to clipboard
fun <D : Executable.Data> Executable<D>.readDataFromCache(customScalarAdapters: CustomScalarAdapters, cache: ReadOnlyNormalizedCache, cacheResolver: CacheResolver, cacheHeaders: CacheHeaders): D
fun <D : Fragment.Data> Fragment<D>.readDataFromCache(cacheKey: CacheKey, customScalarAdapters: CustomScalarAdapters, cache: ReadOnlyNormalizedCache, cacheResolver: CacheResolver, cacheHeaders: CacheHeaders): D
Link copied to clipboard
fun <D : Executable.Data> CacheData.toData(adapter: Adapter<D>, customScalarAdapters: CustomScalarAdapters, variables: Executable.Variables): D