fix: Create context cache only when prefix matches with previous request

PiperOrigin-RevId: 817468275
This commit is contained in:
Xiang (Sean) Zhou
2025-10-09 21:19:28 -07:00
committed by Copybara-Service
parent 731bb9078d
commit 9e0b1fb62b
8 changed files with 265 additions and 162 deletions
@@ -36,7 +36,7 @@ class TestCachePerformanceAnalyzer:
self.analyzer = CachePerformanceAnalyzer(self.mock_session_service)
def create_cache_metadata(
self, invocations_used=1, cache_name="test-cache", cached_contents_count=5
self, invocations_used=1, cache_name="test-cache", contents_count=5
):
"""Helper to create test CacheMetadata."""
return CacheMetadata(
@@ -46,7 +46,7 @@ class TestCachePerformanceAnalyzer:
expire_time=time.time() + 1800,
fingerprint="test_fingerprint",
invocations_used=invocations_used,
cached_contents_count=cached_contents_count,
contents_count=contents_count,
created_at=time.time() - 600,
)