Exemple #1
0
        public Task <ICounterResult> Decrement(string id, Action <DecrementOptions> configureOptions)
        {
            var options = new DecrementOptions();

            configureOptions(options);

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

            configureOptions(options);

            return(binaryCollection.DecrementAsync(id, options));
        }
        public async Task <ICounterResult> DecrementAsync(string id, DecrementOptions options)
        {
            using (var op = new Decrement
            {
                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));
            }
        }