Background:
Both cache and rate limit policies resolve route pattern independently on the same request path. On high RPS routes with chained policies, this duplicates work on a hot path.
Problem:
Route pattern extraction is repeated in internal/core/policy/cache.go and internal/core/policy/ratelimit.go, increasing per-request overhead.
Scope:
- Introduce a per-request route pattern resolver/cache in policy flow.
- Update cache and rate limit policies to reuse the same resolved value.
- Add a benchmark case for chained policy execution in internal/core/policy/benchmark_test.go.
Tasks:
Acceptance Criteria:
- Route pattern is resolved at most once per request in chained policy scenarios.
- Behavior and response semantics remain unchanged.
- Benchmark shows reduced ns/op for policy chain path.
Background:
Both cache and rate limit policies resolve route pattern independently on the same request path. On high RPS routes with chained policies, this duplicates work on a hot path.
Problem:
Route pattern extraction is repeated in internal/core/policy/cache.go and internal/core/policy/ratelimit.go, increasing per-request overhead.
Scope:
Tasks:
Acceptance Criteria: