We’re overhauling Dgraph’s docs to make them clearer and more approachable. If
you notice any issues during this transition or have suggestions, please
let us know.
Caching refers to external caching at the browser/CDN level. Internal caching
at the database layer isn’t currently supported.
Enabling cached results
To enable the external result cache you need to add the@cacheControl(maxAge: int)
directive at the top of your query. This directive
adds the appropriate Cache-Control
HTTP headers to the response, so that
browsers and CDNs can cache the results.
For example, the following query defines a cache with TTL of 15 seconds.