We’ve long felt that those who own the data are best suited to determine its cacheability. Our JS-based config file supports this pattern well - especially for monorepos and small-to-medium sized organizations. However, as larger and larger organizations adopt Stellate, as well as organizations using non-monorepo patterns, we’ve received a lot of feedback about how to make the cache configuration more scalable.
For that reason, with the release of cli version 2.7.0
, we’re excited to introduce support for directive-based cache configuration.
The stellate_cache
directive enables you to define cache rules directly in your GraphQL schema. You can configure the maxAge
, SWR
and scope
for both types and fields. The changes in your schema will automatically be applied to your Stellate service by your CI on your next deploy using the existing stellate push
CLI command.
When changes are pushed to Stellate, a config file is still generated automatically. This allows you to continue to centrally define things like scopes, which are typically used organization-wide. It also enables safety guarantees, as collisions and errors are discovered at build-time and can prevent bad deployments. You can also leverage stellate push --dry
when developing locally to see the impact of inflight changes.
Cache directives are available when using cli version 2.7.0
and above. To learn more, head on over to our docs.