ReadOnlyNormalizedCache

Properties

Link copied to clipboard

Some cache implementations (e.g. com.apollographql.cache.normalized.internal.OptimisticNormalizedCache and com.apollographql.cache.normalized.memory.MemoryCache) support chaining caches. For those, this returns the next cache in the chain or null if there is none. Implementations that don't support chaining return null.

Functions

Link copied to clipboard
open suspend fun close()
Link copied to clipboard
abstract suspend fun dump(): Map<@JvmSuppressWildcards KClass<*>, Map<CacheKey, Record>>
Link copied to clipboard
abstract suspend fun loadAllRecords(): Flow<Record>

Returns a Flow emitting all records stored in this cache.

Link copied to clipboard
abstract suspend fun loadRecord(key: CacheKey, cacheHeaders: CacheHeaders): Record?
Link copied to clipboard
abstract suspend fun loadRecords(keys: Collection<CacheKey>, cacheHeaders: CacheHeaders): Collection<Record>

Calls through to 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
open suspend fun size(): Long

Returns the total size in bytes of this cache. This is an optional operation that can be implemented by caches for debug or observability purposes, otherwise it defaults to -1, meaning unknown size.

Link copied to clipboard
open fun sizeOfRecord(record: Record): Int

Returns the size in bytes of a Record. This is an optional operation that can be implemented by caches for debug purposes, otherwise it defaults to -1, meaning unknown size.