wso2 / wso2/api-platform

[API Policies] Semantic Cache Policy Issue

Open
#696 0 comments 0 reactions 1 assignee View on GitHub

@Thenujan-Nagaratnam is already working on this.

Since Jan 15, 2026.

Dominant language
Go
Stars
71
Forks
111
Avg merge
1d 14h
Merged PRs (30d)
110

Description

Overview

Cache isolation bug prevents cache hits when API identity information is missing, completely defeating the caching mechanism.


Issue Details

Fallback to RequestID Causes Cache Isolation Per Request

File: semanticcache.go (lines 429-434)

Description:
When apiID is ":" (indicating missing API name/version), the code falls back to using ctx.RequestID as the cache key. Since RequestID is unique per request, this prevents any cache sharing across requests - each response gets cached under a different key and can never be retrieved.

Code Flow:

apiID := fmt.Sprintf("%s:%s", ctx.APIName, ctx.APIVersion)
if apiID == ":" {
    apiID = ctx.RequestID // PROBLEM: Unique per request!
}

Proposed Fix:
Use a meaningful fallback for apiID instead of RequestID, such as a default value or log a warning about missing apiID.

Impact:
Cache hits will never occur when apiID is ":", completely defeating the purpose of semantic caching.

Reference

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.