Negative cache for 404 NOT_FOUND - #7334
Open
chrisrueger wants to merge 3 commits into
Open
Conversation
Implement negative caching to avoid repeated requests for non-existent resources. When a 404 response is received, the metadata is cached with a notFound flag. Subsequent requests within the TTL window will return the cached 404 without making a network request. This reduces load on servers and improves performance for missing resource scenarios e.g. missing -sources.jar files of dependencies Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
chrisrueger
marked this pull request as ready for review
July 23, 2026 10:21
Contributor
Author
|
@jhanders34 are you able to access https://github.com/bndtools/bnd/actions/runs/29997607951 and download the This is the bndtools Eclipse plugin jar of this PR which you could install into Eclipse via "Help / Install new software" to test the PR if it improves the situation for you. |
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.
Closes #7310
This pull request introduces negative caching for HTTP 404 (Not Found) responses in the HTTP client and cache system. Now, when a resource is not found, the system records this state in the cache, allowing future requests to avoid unnecessary network calls until the cache entry expires. The changes also update related tests and increment the package version.
Negative caching implementation:
notFoundflag to the cache metadata (InfoDTO) and methods to record and check negative cache entries (updateNegativeCache,hasNegativeCache) inURLCache.java. [1] [2] [3]HttpClient.javato save negative cache entries when a 404 is received, and to return cached 404 responses if present and valid. [1] [2] [3]Test updates for negative caching:
HttpClientTest.javaandRemoteRepoTest.javato reflect the new behavior: 404 responses are now cached, and tests force cache refreshes as needed. [1] [2]Version update:
package-info.javato2.2.0to reflect these changes.