Exemplo n.º 1
0
        public Task <ICounterResult> Increment(string id, Action <IncrementOptions> configureOptions)
        {
            var options = new IncrementOptions();

            configureOptions(options);

            return(Increment(id, options));
        }
        public static Task <ICounterResult> IncrementAsync(this IBinaryCollection binaryCollection, string id,
                                                           Action <IncrementOptions> configureOptions)
        {
            var options = new IncrementOptions();

            configureOptions(options);

            return(binaryCollection.IncrementAsync(id, options));
        }
        public async Task <ICounterResult> IncrementAsync(string id, IncrementOptions options)
        {
            using (var op = new Increment
            {
                Cid = Cid,
                Key = id,
                Delta = options.Delta,
                Initial = options.Initial,
                DurabilityLevel = options.DurabilityLevel
            })
            {
                await ExecuteOp(op, options.Token, options.Timeout);

                return(new CounterResult(op.GetValue(), op.Cas, null, op.MutationToken));
            }
        }