AlinsRan opened a new pull request, #13435:
URL: https://github.com/apache/apisix/pull/13435

   ## Summary
   
   Add a new `graphql-proxy-cache` plugin that caches GraphQL query responses 
on disk or in memory, reusing the existing `proxy-cache` infrastructure.
   
   ## What does this PR do?
   
   - Adds `apisix/plugins/graphql-proxy-cache.lua`
   - Adds tests in `t/plugin/graphql-proxy-cache/graphql.t`
   - Adds English documentation `docs/en/latest/plugins/graphql-proxy-cache.md`
   - Registers the plugin in the default plugin list (priority: 1009)
   
   ## Features
   
   - **Dual caching strategies**: disk (via NGINX `proxy_cache`) or memory (via 
shared dict)
   - **Automatic mutation bypass**: requests containing `mutation` operations 
are never cached; the cache is bypassed and the upstream is reached directly
   - **Deterministic cache key**: `md5(conf_version + host + route_id + 
service_id + identity + query_body)` — scoped to the route/service/host so two 
routes sharing the same plugin config never collide
   - **Consumer isolation** (default on): each authenticated consumer (by 
`consumer_name` or `remote_user`) gets its own cache namespace, preventing data 
leakage across consumers
   - **PURGE API**: `PURGE 
/apisix/plugin/graphql-proxy-cache/:strategy/:route_id/:cache_key` for cache 
invalidation, exposed via the `public-api` plugin
   - **GraphQL over GET and POST**: handles both `application/json` and 
`application/graphql` content types for POST; query string for GET
   
   ## Testing
   
   19 test cases covering:
   - Schema validation (invalid zone, invalid strategy)
   - Request validation (wrong method, empty body, oversized body, malformed 
JSON, missing query field)
   - Mutation bypass
   - Memory cache hit/miss and purge
   - Disk cache hit/miss and purge
   - Purge with wrong route ID or cache key


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to