shreemaan-abhishek opened a new pull request, #13523:
URL: https://github.com/apache/apisix/pull/13523

   ### Description
   
   The `graphql-proxy-cache` memory-strategy PURGE handler only removed the 
legacy base-key cache slot, so `Vary` variants survived a PURGE and kept 
serving stale HITs until each variant's own TTL expired.
   
   The in-memory proxy-cache strategy (which `graphql-proxy-cache` reuses for 
its `access`/`header_filter`/`body_filter` phases) stores `Vary` responses as:
   
   - `<base>::__vary` — the variant index
   - `<base>::<sig>` — one entry per variant
   - `<base>` — an optional legacy no-Vary entry
   
   But `graphql-proxy-cache` ships its own PURGE handler that bypassed 
`memory_handler` and called the low-level `memory:purge(base_key)` directly, 
which is just `dict:delete(key)` over a single slot. So PURGE removed only 
`<base>` and left the index and every variant intact.
   
   The standard `proxy-cache` PURGE flow is unaffected because it already 
routes through `memory_handler.access`, which walks all variants via 
`purge_all_variants`.
   
   **Fix:** export the existing file-local `purge_all_variants(memory, 
base_key)` helper from `memory_handler.lua` as a module function and use it in 
the `graphql-proxy-cache` PURGE handler, instead of the direct `memory:purge` 
call. This keeps the variant-walk logic in one place. No schema change, no new 
config option. The disk strategy is unaffected (NGINX's native `proxy_cache` 
handles Vary).
   
   ### Test
   
   Added `TEST 16` in `t/plugin/graphql-proxy-cache/memory.t`: it populates two 
distinct `Vary` variants under one base key, issues a single PURGE, and asserts 
both variants MISS afterward. Verified locally that the test passes with the 
fix and fails without it (both variants stay HIT after PURGE).
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change (N/A — no 
user-facing behavior or config change; this makes the already-documented PURGE 
behavior correct for Vary variants)
   - [x] I have verified that this change is backward compatible


-- 
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