Record

class Record(val key: CacheKey, val fields: Map<String, RecordValue?>, val mutationId: Uuid? = null, val metadata: Map<String, Map<String, ApolloJsonElement?>> = emptyMap(), val sizeInBytes: Int = -1) : 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.

Constructors

Link copied to clipboard
constructor(key: CacheKey, fields: Map<String, RecordValue?>, mutationId: Uuid? = null, metadata: Map<String, Map<String, ApolloJsonElement?>> = emptyMap(), sizeInBytes: Int = -1)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val entries: Set<Map.Entry<String, Any?>>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val keys: Set<String>
Link copied to clipboard
val metadata: Map<String, Map<String, ApolloJsonElement?>>

Arbitrary metadata that can be attached to each field.

Link copied to clipboard
val mutationId: Uuid?
Link copied to clipboard
open override val size: Int
Link copied to clipboard

Size of the record in bytes. This is an optional field that can be set by the cache implementation for debug purposes, otherwise it defaults to -1, meaning unknown size.

Link copied to clipboard
open override val values: Collection<Any?>

Functions

Link copied to clipboard
open override fun containsKey(key: String): Boolean
Link copied to clipboard
open override fun containsValue(value: Any?): Boolean
Link copied to clipboard
Link copied to clipboard

Returns a set of all field keys. A field key incorporates any GraphQL arguments in addition to the field name.

Link copied to clipboard
open operator override fun get(key: String): Any?
Link copied to clipboard
open override fun isEmpty(): Boolean
Link copied to clipboard
fun mergeWith(newRecord: Record): Pair<Record, Set<String>>

Returns a merge result record and a set of field keys which have changed, or were added. A field key incorporates any GraphQL arguments in addition to the field name.

Link copied to clipboard
fun <D : Executable.Data> DataWithErrors.normalized(executable: Executable<D>, cacheKeyGenerator: CacheKeyGenerator, rootKey: CacheKey = CacheKey.QUERY_ROOT, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, metadataGenerator: MetadataGenerator = EmptyMetadataGenerator, fieldKeyGenerator: FieldKeyGenerator = DefaultFieldKeyGenerator, embeddedFieldsProvider: EmbeddedFieldsProvider = EmptyEmbeddedFieldsProvider, maxAgeProvider: MaxAgeProvider = DefaultMaxAgeProvider): Map<CacheKey, Record>

Normalizes this executable data to a map of Record keyed by Record.key.

Link copied to clipboard
Link copied to clipboard

Returns the list of referenced cache fields

Link copied to clipboard
fun Record.withDates(receivedDate: String?, expirationDate: String?): Record
Link copied to clipboard
fun Record.withSizeInBytes(sizeInBytes: Int): Record