Under the Hood: Response Tagging

  • app:XYZ: an internal ID to identify records of a single Stellate service
  • query:launchesPast: the root field used
  • type:Launch: the type (or types) returned by the query
  • key:Launch:id:109 the combination of type, key field, and value of that key field for a specific instance returned by the query
  • key:Launch:id:108

Key Fields

If you have additional key fields defined for your types, Stellate tags documents with tags referencing those additional key fields as well.

For example, if the Launch type referenced above also has a field called launch_name that uniquely identifies a single launch, you could add this field to your list of key fields. Any query that fetches an entity of type Launch and also requests the launch_name key field is then also tagged with the appropriate tag:

  • key:Launch:launch_name:Buttercup Moon

By default, Stellate treats any id, _id, and key fields on your types as key fields and tags responses with those. You can however configure this according to your requirements.

Nested Types

Similarly, if we extend our original query and ask for additional information available in nested types, Stellate would add tags for those types as well. Asking for more information about the rocket, for example,

query {
  launchesPast(limit: 2) {
    __typename
    id
    mission_name
    launch_date_utc
    rocket {
      __typename
      rocket {
        __typename
        id
      }
    }
  }
}

would return this response

{
  "data": {
    "launchesPast": [
      {
        "__typename": "Launch",
        "id": "109",
        "mission_name": "Starlink-15 (v1.0)",
        "launch_date_utc": "2020-10-24T15:31:00.000Z",
        "rocket": {
          "__typename": "LaunchRocket",
          "rocket": {
            "__typename": "Rocket",
            "id": "falcon9"
          }
        }
      },
      {
        "__typename": "Launch",
        "id": "108",
        "mission_name": "Sentinel-6 Michael Freilich",
        "launch_date_utc": "2020-11-21T17:17:00.000Z",
        "rocket": {
          "__typename": "LaunchRocket",
          "rocket": {
            "__typename": "Rocket",
            "id": "falcon9"
          }
        }
      }
    ]
  }
}

and would store it in Stellate Edge Cache tagged with the following tags:

  • app:XYZ
  • query:launchesPast
  • type:Launch
  • type:LaunchRocket
  • type:Rocket
  • key:Launch:id:109
  • key:Launch:id:108
  • key:Rocket:falcon9