<PackageReference Include="System.ClientModel" Version="1.15.0" />

System.ClientModel.Primitives.CredentialCache

static class CredentialCache
Process-wide cache of resolved CredentialSettings instances keyed by a hash of the merged credential section content. Resolver-matched entries are additionally keyed by the reference-identity hash of the resolver instance that produced the provider, so two callers with identical effective config that share a resolver instance also share one settings instance (and the token-layer cache inside the provider). Distinct resolver instances (even of the same type) get distinct cache entries — a custom resolver carrying instance state (e.g., per-host secrets) cannot leak its provider into another caller's chain. Chain-owning resolvers — identified by invoking resolveChild during TryResolve — are NOT cached; each resolution builds a fresh wrapper that composes cached leaf providers via resolveChild, so the token-layer cache lives on the leaves where it belongs and a chain wrapper cannot leak its captured chain across callers. Inline credential sections that no resolver claims are cached under a single section-only key, so the inline-ApiKey path benefits from caching too.
public static CredentialSettings GetOrCreateInline(IConfigurationSection mergedSection)

Returns a cached CredentialSettings for the inline credential data in mergedSection — the no-resolver match path. The settings has TokenProvider set to null and exposes the section's bound metadata (Key, CredentialSource, AdditionalProperties, indexer). Repeated calls for the same section content return the same instance.

public static CredentialSettings GetOrTryResolve(IConfigurationSection mergedSection, CredentialResolver resolver, Func<IConfigurationSection, AuthenticationTokenProvider> resolveChild)

Look up a cached CredentialSettings for (mergedSection, resolver); on miss, call TryResolve. If the resolver matches and produces a non-null provider, build a CredentialSettings for it. The result is cached only when the provider is non-disposable and the resolver did NOT invoke resolveChild (i.e., is not a chain owner); otherwise the freshly built settings are returned without caching. Returns null when the resolver does not match (the no-match case is handled by GetOrCreateInline).