How to invalidate GraphQL Sever Cache


As part of our project we are consuming catalog events (Axon as event store) and creating our projection. Our graphql application queries this projection database (mongo) and returns the result. We have used apollo graphql caching to improve the performance. Since we are using the GraphQL only for query purpose, how can we invalidate the apollo server cache in case there is change in catalog data. Is there any API which I can trigger to clear the cache? The document talks about how to invalidate cache from the client perspective (react) but I am looking for some backend solution to invalidate the cache at server side either through API or possibly consuming event.

Suresh B

@sureshdarisa take a look at: GitHub - thematters/apollo-response-cache: Caching and invalidation mechanisms (plugins, directives) of Apollo GraphQL

@hwillson In our case we don’t have mutations. we are using GraphQL only for Query. How can I use this package to invalidate apollo server cache? We want to give flexibility to backend team to invalidate apollo server cache whenever they want to invalidate. I hope you understand the requirement.