/// <summary> /// Slot implementation. /// </summary> /// <param name="signaler">Signaler that raised the signal.</param> /// <param name="input">Arguments to slot.</param> public async Task SignalAsync(ISignaler signaler, Node input) { var offset = input .Children .FirstOrDefault(x => x.Name == "offset")? .GetEx <int>() ?? 0; var limit = input .Children .FirstOrDefault(x => x.Name == "limit")? .GetEx <int>() ?? 10; var filter = input.GetEx <string>() ?? input .Children .FirstOrDefault(x => x.Name == "filter")? .GetEx <string>(); input.Clear(); input.Value = null; var items = (await _cache.ItemsAsync(filter, false)) .Skip(offset) .Take(limit) .OrderBy(x => x.Key); input.AddRange( items .Select(x => new Node(".", null, new Node[] { new Node("key", x.Key), new Node("value", x.Value) }))); }
/// <summary> /// Slot implementation. /// </summary> /// <param name="signaler">Signaler that raised the signal.</param> /// <param name="input">Arguments to slot.</param> public async Task SignalAsync(ISignaler signaler, Node input) { var filter = input.GetEx <string>() ?? input .Children .FirstOrDefault(x => x.Name == "filter")? .GetEx <string>(); input.Clear(); input.Value = null; input.Value = (await _cache.ItemsAsync(filter)).Count(); }