public static Task <IMutationResult> ReplaceAsync <T>(this ICouchbaseCollection collection, string id, T content, Action <ReplaceOptions> configureOptions) { var options = new ReplaceOptions(); configureOptions(options); return(collection.ReplaceAsync(id, content, options)); }
public async Task <IMutationResult> ReplaceAsync <T>(string id, T content, ReplaceOptions options) { var transcoder = options.Transcoder ?? _transcoder; using (var replaceOp = new Replace <T> { Key = id, Content = content, Cas = options.Cas, Cid = Cid, Expires = options.Expiry.ToTtl(), DurabilityLevel = options.DurabilityLevel, DurabilityTimeout = TimeSpan.FromMilliseconds(1500), Transcoder = transcoder }) { await _bucket.SendAsync(replaceOp, options.Token, options.Timeout).ConfigureAwait(false); return(new MutationResult(replaceOp.Cas, null, replaceOp.MutationToken)); } }