Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Validator] Optimize fetching the same external resource multiple times #467

Closed
ewoutkramer opened this issue Oct 27, 2017 · 3 comments
Closed

Comments

@ewoutkramer
Copy link
Member

Somewhere there should be caching involved.....but how to go about cache invalidation?

@wmrutten
Copy link
Contributor

CachedResolver exposes InvalidateByUri and InvalidateByCanonicalUri methods for cache invalidation.
Access to the internal data structure is synchronized, so it should be thread safe.
E.g. while the validator is running, another thread could invalidate a cache entry. Subsequent requests to for that entry will cause the CachedResolver to try and re-load the requested artifact from the backing source.

@ewoutkramer
Copy link
Member Author

You're right, but I am not fetching external resources using an IResourceResolver I think. Or maybe I do ;-) Well, I'll double check and if not see how to integrate IResourceResolver into resolving external (instance) references (not necessarily to conformance resources)

@marcovisserFurore
Copy link
Member

External resources are fetched by subscribing to the event OnExternalResolutionNeeded. When you are not doing that, the Validator tries to resolve the resource with his own IResourceResolver, which is not cached.
When you are using the OnExternalResolutionNeeded you can control, as an end-user, the way how external resources are fetched and thus implement a caching mechanism for that as well.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants