private void PublishEvent(string cacheKey, EventType eventType, string backendUniqueIdentifier) { var cacheKeyEvent = new CacheKeyEvent { CacheKey = cacheKey, EventType = eventType, CacheBackendIdentifier = backendUniqueIdentifier }; _queueClient.Publish(EventPublishingExchange, EventPublishingRoute, cacheKeyEvent); }
private Task PropagateEventAsync(CacheKeyEvent cacheKeyEvent, CancellationToken cancellationToken) { var elegibleBackends = _cacheBackends.TakeWhile( backend => backend.GetUniqueIdentifier() != cacheKeyEvent.CacheBackendIdentifier); var deleteTasks = elegibleBackends.Select(backend => backend.DeleteAsync(cacheKeyEvent.CacheKey)); return(Task.WhenAll(deleteTasks)); }