Task <T> ZAddAsync <T>(string key, bool nx, bool xx, ZAddThan?than, bool ch, bool incr, decimal score, string member, params object[] scoreMembers) { if (scoreMembers?.Length > 0) { var members = scoreMembers.MapToList((sco, mem) => new ZMember(mem.ConvertTo <string>(), sco.ConvertTo <decimal>())); members.Insert(0, new ZMember(member, score)); return(ZAddAsync <T>(key, nx, xx, than, ch, incr, members)); } return(ZAddAsync <T>(key, nx, xx, than, ch, incr, new[] { new ZMember(member, score) })); }
Task <TReturn> ZAddAsync <TReturn>(string key, bool nx, bool xx, ZAddThan?than, bool ch, bool incr, IEnumerable <ZMember> scoreMembers) { var cmd = "ZADD" .InputKey(key) .InputIf(nx, "NX") .InputIf(xx, "XX") .InputIf(than != null, than) .InputIf(ch, "CH") .InputIf(incr, "INCR"); foreach (var sm in scoreMembers) { cmd.InputRaw(sm.score).InputRaw(sm.member); } return(CallAsync(cmd, rt => rt.ThrowOrValue <TReturn>())); }
public Task <long> ZAddXxAsync(string key, ZMember[] scoreMembers, ZAddThan?than = null, bool ch = false) => ZAddAsync <long>(key, false, true, than, ch, false, scoreMembers);
public long ZAddXx(string key, ZMember[] scoreMembers, ZAddThan?than = null, bool ch = false) => ZAdd <long>(key, false, true, than, ch, false, scoreMembers);