Skip to content

http: funnel cache key generation through HttpSM - #13557

Open
JakeChampion wants to merge 1 commit into
apache:masterfrom
JakeChampion:jake/query-cache-key-refactor
Open

http: funnel cache key generation through HttpSM#13557
JakeChampion wants to merge 1 commit into
apache:masterfrom
JakeChampion:jake/query-cache-key-refactor

Conversation

@JakeChampion

Copy link
Copy Markdown
Contributor

The four cache key call sites each open-coded the same Cache::generate_key call with the same two txn_conf arguments, and one of them also open-coded the ATS 9.2 compatibility branch. Collect that into a single HttpSM::generate_cache_key so callers stop repeating the configuration plumbing.

The four cache key call sites each open-coded the same `Cache::generate_key` call with the same two `txn_conf` arguments, and one of them also open-coded the ATS 9.2 compatibility branch. Collect that into a single `HttpSM::generate_cache_key` so callers stop repeating the configuration plumbing.
Copilot AI lite review requested due to automatic review settings August 18, 2026 15:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces duplication in the HTTP state machine by centralizing cache key generation logic in HttpSM, including the ATS 9.2 compatibility-key branch, so cache-related call sites don’t repeat the same configuration plumbing.

Changes:

  • Added HttpSM::generate_cache_key() to encapsulate Cache::generate_key() vs Cache::generate_key92() selection.
  • Replaced open-coded cache key generation in cache lookup/delete/write paths with calls to the new helper.
  • Preserved the existing compatibility-key retry behavior by passing the 9.2 selection as a boolean at the call site.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/proxy/http/HttpSM.cc Introduces the helper and updates cache lookup/delete/write code paths to call it.
include/proxy/http/HttpSM.h Declares the new generate_cache_key() helper on HttpSM.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

void do_drain_request_body(HTTPHdr &response);

void wait_for_full_body();
void generate_cache_key(HttpCacheKey *key, URL *url, bool compat = false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants