FastQL is a caching layer for your GraphQL backend that sits between the client and your servers. It is unique to GraphQL, in that it does not treat all requests as blobs, instead it inspects the contents of the request and response to make smarter cache decisions.
FastQL works with any GraphQL server that complies with the GraphQL spec and uses HTTP
- Does not currently support subscriptions, websockets, or HTTP
extensionssection of the response is not cached, and will be ommitted from responses served from cache. Please contact us if there are extensions critical to your service.
- Requests that require authentication, or return a personalized response without modification to the GraphQL query, should not be cached. To control what is and isn't cached, please see the headers section.
- Requests with queries larger than 500KB. or responses larger than 1MB will not be cached.
How it Works¶
Common queries are cached at edge locations around the world so that users experience quick response times from a server in their region. If a regional location does not have an up to date cache for a request, it will make the request to your origin server and then cache it for future requests.
Mutations are write operations in GraphQL, so FastQL does not attempt to cache mutations. Mutations will be sent to the origin server, and optionally trigger an invalidation of related cache entries.
Partial Cache for Batched Queries¶
A common practice with GraphQL is to query for disparate data by using query batching, where a client combines multiple query trees into one query operation.
When a requests contains multiple top-level trees in a query, it's possible for each tree to be cached independently. For example, if you have a react website that has multiple components on each page, each component will be cached separately, even if they are combined into one query. This gives the cache more granularity, so that cache invalidations impact as little as possible, resulting in a higher hit rate.
Example: Update Website when New Article is Added
See an example of how you might invalidate the homepage and "latest articles" widgets when a new article is added to your website or app. Go to Example
Because the cache layer is GraphQL aware, there are opportunities to do smarter, and in some cases implicit, invalidation. Please see the invalidation section for more details.