@cachecontrol
官网:https://www.apollographql.com/docs/apollo-server/migration/#cachecontrol
在Apollo Server 2
中,@cacheControl
指令的定义(以及它使用的CacheControlScope
枚举)有时会自动插入到你的schema
中。(特别是,如果您使用typeDefs
和resolvers
选项定义schema
,则会添加它们,但是,如果您使用modules
或shema options
或federated gateway
,则不会添加它们。传递cacheControl: false
不会阻止插入定义!)
在ApolloServer 3
中,这些定义永远不会自动插入。
In Apollo Server 2, definitions of the @cacheControl directive (and the CacheControlScope enum that it uses) were sometimes automatically inserted into your schema. (Specifically, they were added if you defined your schema with the typeDefs and resolvers options, but not if you used the modules or schema options or if you were a federated gateway. Passing cacheControl: false did not stop the definitions from being inserted!) In Apollo Server 3, these definitions are never automatically inserted.
enum CacheControlScope {
PUBLIC
PRIVATE
}
directive @cacheControl(
maxAge: Int
scope: CacheControlScope
inheritMaxAge: Boolean
) on FIELD_DEFINITION | OBJECT | INTERFACE | UNION