-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TitaniumJsonLd context caching loads document on every call #4232
Comments
thanks for reporting, would you like to provide a PR to implement this enhancement? (definitely not a bug) |
I would not agree that it is not a bug, document cache is not being properly utilized :) In any case it should be a simple fix: var document = Optional.ofNullable(documentCache.get(uri));
if (document.isEmpty()) {
return loader.loadDocument(uri, options);
}
return document.get(); using orElseGet would require additional code to handle |
@ricardas-buc no worries, a PR has been already opened for this enhancement |
Bug Report
Describe the Bug
A mixup of orElse VS orElseGet causes document to be loaded every time, even though cache is being hit.
Connector/core/common/lib/json-ld-lib/src/main/java/org/eclipse/edc/jsonld/TitaniumJsonLd.java
Lines 199 to 200 in 564d627
Expected Behavior
Cached document should not be loaded again.
Context Information
Detailed Description
If applicable, add screenshots and logs to help explain your problem.
Possible Implementation
Switching to orElseGet solves the issue. This does save extra 2-5ms per execution.
The text was updated successfully, but these errors were encountered: