Hi all!
I’m struggling using the Apollo Server-side caching features. I just want to use the static way defining cache control directly in the graphQL Schema (see the v3 documentation of server-side caching of apollo).
It uses a custom directive named @cacheControl, but it seems that the graphQL strapi plugin totally skip this directive when it builds the nexus schema using the content-api service:
I saw some old issues about it:
But it doesn’t help me
I know that I can define cache-control in a dynamic way, and it works like a charm but I want to try the static way.
Maybe I miss something obvious?
In my typeDefs of registering strapi I use:
extensionService.use(({ strapi }) => ({
typeDefs: `
enum CacheControlScope {
PUBLIC
PRIVATE
}
directive @cacheControl(
maxAge: Int
scope: CacheControlScope
inheritMaxAge: Boolean
) on FIELD_DEFINITION | OBJECT | INTERFACE | UNION
type CategoryRelationResponseCollection @cacheControl(maxAge: 1000) {
data: [CategoryEntity!]!
}
`
...
In order to make my CategoryRelationResponseCollection cached, but it litterally caches nothing…