Beispiel #1
0
        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);
        }
Beispiel #2
0
        public async Task Trigger(CacheEvent cacheEvent)
        {
            var keys = await ICacheService.GetSetAsync(cacheEvent.Name);

            await ICacheService.RemoveAsync(keys);
        }
Beispiel #3
0
 private string GetSetKey(CacheEvent cacheEvent)
 => $"{nameof(CacheEventService)}:{cacheEvent.Name}";