protected virtual async Task OnItemExpiredAsync(string key) { var args = new ItemExpiredEventArgs { Client = this, Key = key }; await(ItemExpired?.InvokeAsync(this, args) ?? Task.CompletedTask).AnyContext(); }
private Task OnItemExpiredAsync(string key, bool sendNotification = true) { var args = new ItemExpiredEventArgs { Client = this, Key = key, SendNotification = sendNotification }; return(ItemExpired?.InvokeAsync(this, args) ?? Task.CompletedTask); }
private async Task OnItemExpiredAsync(string key, bool sendNotification = true) { var args = new ItemExpiredEventArgs { Client = this, Key = key, SendNotification = sendNotification }; await(ItemExpired?.InvokeAsync(this, args) ?? Task.CompletedTask).AnyContext(); }
private async Task OnLocalCacheItemExpiredAsync(object sender, ItemExpiredEventArgs args) { if (!args.SendNotification) { return; } _logger.Trace("Local cache expired event: key={0}", args.Key); await _messageBus.PublishAsync(new InvalidateCache { CacheId = _cacheId, Keys = new[] { args.Key }, Expired = true }).AnyContext(); }
private Task OnLocalCacheItemExpiredAsync(object sender, ItemExpiredEventArgs args) { if (!args.SendNotification) { return(Task.CompletedTask); } if (_logger.IsEnabled(LogLevel.Trace)) { _logger.LogTrace("Local cache expired event: key={Key}", args.Key); } return(_messageBus.PublishAsync(new InvalidateCache { CacheId = _cacheId, Keys = new[] { args.Key }, Expired = true })); }
private void OnItemExpiredAsync(string key, bool sendNotification = true) { if (ItemExpired == null) { return; } Task.Factory.StartNew(state => { var args = new ItemExpiredEventArgs { Client = this, Key = key, SendNotification = sendNotification }; return(ItemExpired.InvokeAsync(this, args)); }, this, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default); }