private void updateCache(final HttpHost host,
                             final String pathPrefix,
                             final AuthScheme authScheme,
                             final HttpClientContext clientContext) {
        final boolean cacheable = authScheme.getClass().getAnnotation(AuthStateCacheable.class) != null;
        if (cacheable) {
            AuthCache authCache = clientContext.getAuthCache();
            if (authCache == null) {
                authCache = new BasicAuthCache(schemePortResolver);
                clientContext.setAuthCache(authCache);
            }
            if (LOG.isDebugEnabled()) {
                final String exchangeId = clientContext.getExchangeId();
                LOG.debug("{} Caching '{}' auth scheme for {}{}", exchangeId, authScheme.getName(), host,
                        pathPrefix != null ? pathPrefix : "");
            }
            authCache.put(host, pathPrefix, authScheme);
        }
    }
Utility class that implements commons aspects of the client side authentication cache keeping.

@since 5.2
httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/AuthCacheKeeper.java