Skip to content
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

Access to the validator's cache needed to be able to selectively flush items from the cache. #375

Open
brianpos opened this issue Oct 4, 2024 · 0 comments

Comments

@brianpos
Copy link

brianpos commented Oct 4, 2024

Or alternately support providing the cache to the settings object so that you don't need to maintain an essentially static validator.
My use case is that I have transient profiles that I wish to validate in the service and not retain the extra compiled schemas for the transient profiles.

The CachedResolver has access to clear and invalidate a URL - these are specifically what I would like to be able to do.

The way I used this in the old validator was to provide the following as myroutines source

var inMemResolver = ...; // an in memory resolver that's backed by a simple Dictionary that is populated in the operation
var _dirSource = new DirectorySource(Directory, ... );
var cacheResolver = new CachedResolver(
    new MultiResolver(
       _dbResolver,
        _dirSource,
        ZipSource.CreateValidationSource()
        ));

source = new MultiResolver(inMemResolver, cachedResolver);

Interestingly you copy over the cache in the constructor, even if it already had one too - which would have been a technique to retain the settings, but not the cache - which I'd argue was tied to the resolver...
I assume there was a reason not to put the cache content into an annotation in the SD from the resolver.

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

No branches or pull requests

1 participant