new InMemoryCache()?

First Time Query is Sent:

Next Time Query is Sent:

  1. Identify the Object (Lift)
  2. Generate an ID
  3. Replace object field with References
  4. Store normalized object
cache-first default - check the cache first, hit network if data isn't present
cache-only only check the cache, throws an error if there isn't data
cache-and-network check the cache, return the data from cache (if it exists), but hit the network to update the data either way
network-only don't check the cache
no-cache don't check the cache, don't even save results in cache

enum PetCategory

DOG

CAT

STINGRAY

RABBIT

type Pet

id: ID!

name: String!

category: PetCategory!

        ...

HORSE

sleepAmount: Int

curious: Boolean

favoriteFood: String

floppy: Int

good: Boolean

chill: Boolean

fast: Boolean

streetsmart: Boolean

majestic: Boolean

interface Pet

type Cat implements Pet

id: ID!

name: String

...

sleepAmount: Int

curious: Boolean

id: ID!

name: String!

weight: Float

status: PetStatus

photo: Photo

dueDate: Date

inCareOf: Customer

type Dog implements Pet

id: ID!

name: String

...

good: Boolean

type Rabbit implements Pet

id: ID!

name: String

...

favoriteFood: String

floppy: Int

type Stingray 

implements Pet

id: ID!

name: String

...

chill: Boolean

fast: Boolean

type Horse 

implements Pet

id: ID!

name: String

...

streetsmart: Boolean

majestic: Boolean

type *TBDFuturePet 

implements Pet

id: ID!

name: String

...

newField: _____

newField: _____

Union Types

type Query {

    familyPets: [FamilyPets!]!

}

union FamilyPet = Cat | Dog

Query

query {
  familyPets {
    __typename
    ...on Cat {
      name
      weight
    }
    ...on Dog {
      name
      status
    }
  }
}

Client Cache Configuration

By Moon Highway

Client Cache Configuration

  • 402