Beispiel #1
0
 private void ProcessEvents()
 {
     foreach (var @event in _eventsCollectionForProcess.GetConsumingEnumerable())
     {
         _storage.AddOrUpdate(@event.ToString(), new EventData());
     }
 }
Beispiel #2
0
 /// <summary>
 ///    Tries to add or update an existing value associated to the <paramref name="key"/>.
 /// </summary>
 public static Task <TValue> AddOrUpdate <TKey, TValue>(
     this IStorage <TKey, TValue> storage,
     TKey key,
     TValue value,
     CancellationToken token = default) =>
 storage.AddOrUpdate(
     key,
     _ => Task.FromResult(value),
     (_, _) => Task.FromResult(value),
     token);
Beispiel #3
0
 /// <summary>
 ///    Tries to add or update an existing value associated to the <paramref name="key"/>.
 /// </summary>
 public static Task <TValue> AddOrUpdate <TKey, TValue>(
     this IStorage <TKey, TValue> storage,
     TKey key,
     Func <TKey, TValue> addFactory,
     Func <TKey, TValue, TValue> updateFactory,
     CancellationToken token = default) =>
 storage.AddOrUpdate(
     key,
     k => Task.FromResult(addFactory(k)),
     (k, old) => Task.FromResult(updateFactory(k, old)),
     token);
Beispiel #4
0
        public override void Handle(ref InsertRequest request, IStorage storage, Socket client)
        {
            storage.AddOrUpdate(request.Key, request.ExpiryDate, request.Object);

            Reply(true, client);
        }
 private void ProcessEvents(Guid @event)
 {
     _storage.AddOrUpdate(@event.ToString(), new EventData());
 }