NormalizedCache

abstract class NormalizedCache : ReadOnlyNormalizedCache

A provider of Record for reading requests from cache.

To serialize a Record to a standardized form use recordAdapter() which handles call custom scalar types registered on the ApolloClient

If a NormalizedCache cannot return all the records needed to read a response, it will be considered a cache miss.

A NormalizedCache is recommended to implement support for CacheHeaders specified in [ ].

A NormalizedCache can choose to store records in any manner.

Constructors

Link copied to clipboard
fun NormalizedCache()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun chain(cache: NormalizedCache): NormalizedCache
Link copied to clipboard
abstract fun clearAll()

Clears all records from the cache.

Link copied to clipboard
abstract fun dump(): Map<@JvmSuppressWildcards KClass<*>, Map<String, Record>>
Link copied to clipboard
abstract fun loadRecord(key: String, cacheHeaders: CacheHeaders): Record?
Link copied to clipboard
abstract fun loadRecords(keys: Collection<String>, cacheHeaders: CacheHeaders): Collection<Record>

Calls through to NormalizedCache.loadRecord. Implementations should override this method if the underlying storage technology can offer an optimized manner to read multiple records. There is no guarantee on the order of returned Record

Link copied to clipboard
abstract fun merge(record: Record, cacheHeaders: CacheHeaders): Set<String>
open fun merge(    record: Record,     cacheHeaders: CacheHeaders,     recordMerger: RecordMerger): Set<String>

abstract fun merge(records: Collection<Record>, cacheHeaders: CacheHeaders): Set<String>
open fun merge(    records: Collection<Record>,     cacheHeaders: CacheHeaders,     recordMerger: RecordMerger): Set<String>

Calls through to NormalizedCache.merge. Implementations should override this method if the underlying storage technology can offer an optimized manner to store multiple records.

Link copied to clipboard
abstract fun remove(pattern: String): Int

Remove records whose key matches a given pattern from this cache and all chained caches

abstract fun remove(cacheKey: CacheKey, cascade: Boolean): Boolean

Remove a record and potentially its referenced records from this cache and all chained caches

Properties

Link copied to clipboard
var nextCache: NormalizedCache? = null

Inheritors

Link copied to clipboard
Link copied to clipboard