public async Task Register(CacheEvent cacheEvent, string cacheKey) { if (cacheEvent == null) { return; } if (cacheEvent.Name.HasContent() != true) { throw new ArgumentException($"{nameof(cacheEvent)} must have content."); } if (!cacheKey.HasContent()) { throw new ArgumentException($"{nameof(cacheKey)} must have content."); } await ICacheService.AddToSetAsync(cacheEvent.Name, cacheKey); }
public async Task Trigger(CacheEvent cacheEvent) { var keys = await ICacheService.GetSetAsync(cacheEvent.Name); await ICacheService.RemoveAsync(keys); }
private string GetSetKey(CacheEvent cacheEvent) => $"{nameof(CacheEventService)}:{cacheEvent.Name}";