public void SetAuthInfo(Uri uri, AuthInfo authInfo) { var key = $"{uri.Scheme}://{uri.Host}:{uri.Port}"; if (authInfo == null || authInfo.Username == null && authInfo.Password == null && authInfo.Domain == null) { AuthInfo val; AuthCache.TryRemove(key, out val); } else { AuthCache.AddOrUpdate(key, authInfo, (s, info) => authInfo); } }