removePublisherClient function
Removes a publisher client from the current event loop's cache and closes it.
Implementation
Future<void> removePublisherClient({
Object? credentials,
String? userAgent,
String? projectId,
}) async {
final LinkedHashMap<_CacheKey, _CacheEntry> loopCache =
_publisherClientCache.get();
final String finalUserAgent = _getFinalUserAgent(userAgent);
final _CacheKey cacheKey = _getCacheKey(
credentials: credentials,
finalUserAgent: finalUserAgent,
projectId: projectId,
);
final _CacheEntry? entry = loopCache.remove(cacheKey);
if (entry != null) {
await _closeClient(entry.$1);
}
}