public async Task <IGetResult> GetAndLockAsync(string id, TimeSpan expiry, GetAndLockOptions options = null) { options = options ?? new GetAndLockOptions(); var transcoder = options.Transcoder ?? _transcoder; using (var getAndLockOp = new GetL <byte[]> { Key = id, Cid = Cid, Expiry = expiry.ToTtl(), Transcoder = transcoder }) { await _bucket.SendAsync(getAndLockOp, options.Token, options.Timeout); return(new GetResult(getAndLockOp.ExtractData(), transcoder) { Id = getAndLockOp.Key, Cas = getAndLockOp.Cas, Flags = getAndLockOp.Flags, Header = getAndLockOp.Header, OpCode = getAndLockOp.OpCode }); } }
public static Task <IGetResult> GetAndLockAsync(this ICouchbaseCollection collection, string id, TimeSpan expiry, Action <GetAndLockOptions> configureOptions) { var options = new GetAndLockOptions(); configureOptions(options); return(collection.GetAndLockAsync(id, expiry, options)); }