public static Task <IGetResult> GetAsync(this ICollection collection, string id, Action <GetOptions> configureOptions) { var options = new GetOptions(); configureOptions?.Invoke(options); return(collection.GetAsync(id, options)); }
public Task <IGetResult> Get(string id, Action <GetOptions> configureOptions) { var options = new GetOptions(); configureOptions?.Invoke(options); return(Get(id, options)); }
public Task <IGetResult> Get(string id, Action <GetOptions> optionsAction) { var options = new GetOptions(); optionsAction(options); return(Get(id, options)); }
public Task <IGetResult> Get(string id, IEnumerable <string> projections = null, TimeSpan?timeout = null, CancellationToken token = default(CancellationToken)) { var options = new GetOptions { ProjectList = projections?.ToList(), Timeout = timeout, Token = token }; return(Get(id, options)); }
public async Task <IGetResult> GetAsync(string id, GetOptions options) { //A projection operation var enumerable = options.ProjectList ?? new List <string>(); if (enumerable.Any() && enumerable.Count < 16) { var specs = enumerable.Select(path => new OperationSpec { OpCode = OpCode.SubGet, Path = path }).ToList(); if (!options.Timeout.HasValue) { options.Timeout = DefaultTimeout; } var lookupOp = await ExecuteLookupIn(id, specs, new LookupInOptions().WithTimeout(options.Timeout.Value)); return(new GetResult(lookupOp.ExtractData(), _transcoder, specs) { Id = lookupOp.Key, Cas = lookupOp.Cas, OpCode = lookupOp.OpCode, Flags = lookupOp.Flags, Header = lookupOp.Header }); } //A regular get operation using (var getOp = new Get <object> { Key = id, Cid = Cid }) { await ExecuteOp(getOp, options.Token, options.Timeout).ConfigureAwait(false); return(new GetResult(getOp.ExtractData(), _transcoder) { Id = getOp.Key, Cas = getOp.Cas, OpCode = getOp.OpCode, Flags = getOp.Flags, Header = getOp.Header }); } }