Repository navigation
refactor(ai): three in-process caches use cachetools - #2611
Merged
Merged
Conversation
The embedding LRU cache and the webhook replay guard stored their keys in an OrderedDict with their own eviction. They now store them in a cachetools LRUCache of the same size, under the lock each one has. The memory cache of the Cloudflare Radar client was a dict with no bound and no expiry. It is now a cachetools TTLCache of at most 1,000 records, whose entries expire after the client's threat-intel TTL. It reads time through the clock seam, so a test moves time with the clock fixture.
Owner
Author
|
Test evidence:
Pending a person: review the diff in tuicr ( |
dan-petty
marked this pull request as ready for review
October 29, 2026 03:16
dan-petty
pushed a commit
that referenced
this pull request
Oct 29, 2026
🤖 I have created a release *beep* *boop* --- ## [0.14.0](v0.13.2...v0.14.0) (2026-10-29) ### Features * **argo:** apps status checks each pinned image against its registry ([#2605](#2605)) ([6933005](6933005)), closes [#1997](#1997) * **k8s:** push the Argo CD notifier App's IDs and key ([#2608](#2608)) ([a408dee](a408dee)) * **release:** an urgent fix merges the release pull request ([#2596](#2596)) ([20e8ac4](20e8ac4)) * **roadmap:** a webhook event runs intake of its one issue ([#2607](#2607)) ([cf9f02c](cf9f02c)), closes [#2009](#2009) * **roadmap:** devops roadmap intake-eval scores duplicates ([#2601](#2601)) ([22146d6](22146d6)) ### Code Refactoring * **ai:** three in-process caches use cachetools ([#2611](#2611)) ([0c30d2a](0c30d2a)), closes [#1993](#1993) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The embedding LRU cache (
_EmbeddingLRUCache) and the webhook replay guard (DeliveryLRUCache) kept their keys in anOrderedDictwith their own eviction. They now keep them in acachetools.LRUCacheof the same size, under the lock each one has. Their interfaces, the hit and miss counters, and the replay refusal stay the same.The memory cache of
CloudflareRadarClientwas adictwith no bound and no expiry, so a long-running process kept each record and never asked Radar again. It is now acachetools.TTLCacheof at most 1,000 records that expire after the client's threat-intel TTL (valkey.threat_intel_ttl, 24 h by default). It reads time through the clock seam, so its test moves time with theclockfixture.cachetools 7.1.8 is already a pinned dependency. The
OrderedDictof the OSV client stays for #1146.Closes #1993
Change:
openspec/changes/archive/2026-10-29-1993-cachetools-caches/