graphql-mesh icon indicating copy to clipboard operation
graphql-mesh copied to clipboard

Handler level plugins/middlewares (mocking, response-caching, rate limiting etc)

Open ardatan opened this issue 9 months ago β€’ 3 comments

In order to have mocking, response caching capabilities in the handler level

ardatan avatar Oct 02 '23 14:10 ardatan

I started to play with the cache today and set up a file-cache as per the docs. I was surprised to see that the cache file does NOT get populated with any data. We are using GraphQL as well as OpenAPI sources.

I would have expected that at least the OpenAPI-based sources would leverage the cache for HTTP header-based caching so we could reduce the load on our downstream source services.

If I read this issue and the GraphQL Mesh source code correctly, this use-case is not (yet ?) covered. Correct?

What would you recommend to do in the meantime? Can we inject a custom fetch handler and implement caching on that level ourselves or do you have any other recommended path? πŸ€”

FGoessler avatar Feb 13 '24 08:02 FGoessler

Actually, my bad. I should have seen this docu page earlier. πŸ™ˆ

That actually seem to do what I am looking for. Sorry for the spam 😬

FGoessler avatar Feb 13 '24 08:02 FGoessler

Let's make things clear at first :) There are cache storage implementations such as file, redis etc which defines WHERE you store the data. It doesn't define HOW things are cached. There are plugins for this purpose; Response Caching, HTTP Caching etc to define HOW the data is cached.

ardatan avatar Feb 13 '24 08:02 ardatan