docs-server: Fix _TTLCache LRU and add separate search cache TTL#181
Merged
docs-server: Fix _TTLCache LRU and add separate search cache TTL#181
Conversation
Replace FIFO eviction with actual LRU using OrderedDict (move_to_end on get, popitem(last=False) for O(1) eviction). Add SEARCH_CACHE_TTL (5min default) for JSON/search cache separate from page cache (1hr). Closes #171 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
vabarbosa
approved these changes
Apr 16, 2026
Collaborator
vabarbosa
left a comment
There was a problem hiding this comment.
thank you. just one minor comment about documenting the env variable
| # HTTP timeout configuration (in seconds) | ||
| HTTP_TIMEOUT = _get_env_float("QISKIT_HTTP_TIMEOUT", 10.0) | ||
| CACHE_TTL = _get_env_float("QISKIT_DOCS_CACHE_TTL", 3600.0) | ||
| SEARCH_CACHE_TTL = _get_env_float("QISKIT_SEARCH_CACHE_TTL", 300.0) # 5 min default |
Collaborator
There was a problem hiding this comment.
should QISKIT_SEARCH_CACHE_TTL is be documented in the README?
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.
Summary
OrderedDict(move_to_endon get,popitem(last=False)for O(1) eviction)SEARCH_CACHE_TTLenv var (default 5min) for search/JSON cache, separate from page cache (1hr)SEARCH_CACHE_TTLdefaultCloses #171