polywrap_uri_resolvers.resolvers.legacy.wrapper_cache_resolver module
This module contains the WrapperCacheResolver.
- class polywrap_uri_resolvers.resolvers.legacy.wrapper_cache_resolver.WrapperCacheResolver(resolver_to_cache: UriResolver, cache: WrapperCache, options: WrapperCacheResolverOptions | None = None)[source]
Bases:
UriResolverDefines a resolver that caches wrappers by uri.
This resolver caches the results of URI Resolution. If result is an uri or package, it returns it back without caching. If result is a wrapper, it caches the wrapper and returns it back.
- Parameters:
resolver_to_cache (UriResolver) – The URI resolver to cache.
cache (WrapperCache) – The cache to use.
options (Optional[WrapperCacheResolverOptions]) – The options to use.
- cache: WrapperCache
- get_options() WrapperCacheResolverOptions | None[source]
Get the options of the resolver.
- Returns:
The options of the resolver.
- Return type:
CacheResolverOptions
- options: WrapperCacheResolverOptions | None
- resolver_to_cache: UriResolver
- try_resolve_uri(uri: Uri, client: InvokerClient, resolution_context: UriResolutionContext) Uri | UriWrapper | UriPackage[source]
Try to resolve a URI to a wrapper, or a URI.
This method tries to resolve the uri with the resolver to cache. If the result is an uri or package, it returns it back without caching. If the result is a wrapper, it caches the wrapper and returns it back.
- Parameters:
uri (Uri) – The URI to resolve.
client (InvokerClient) – The client to use.
resolution_context (UriResolutionContext) – The resolution context to use.
- Returns:
The result of the resolution.
- Return type:
UriPackageOrWrapper
- class polywrap_uri_resolvers.resolvers.legacy.wrapper_cache_resolver.WrapperCacheResolverOptions(*, deserialize_manifest_options: DeserializeManifestOptions, end_on_redirect: bool | None)[source]
Bases:
objectDefines the options for the WrapperCacheResolver.
- Parameters:
deserialize_manifest_options (DeserializeManifestOptions) – The options to use when deserializing the manifest.
end_on_redirect (Optional[bool]) – Whether to end the resolution process when a redirect is encountered. Defaults to False.
- deserialize_manifest_options: DeserializeManifestOptions
- end_on_redirect: bool | None