public IList<string> Info() { IList<string> result = new List<string>(); using (ClientItem c = Pop()) { using (Command cmd = new Command()) { cmd.Add(CONST_VALURES.REDIS_COMMAND_INFO); using (Result r = TcpClient.Send(cmd, c.Client)) { foreach (ArraySegment<byte> item in r.ResultDataBlock) { result.Add(item.GetString()); } } } } return result; }
private void OnDetect(object state) { try { TcpClient client = CreateClient(); using (Command cmd = new Command()) { cmd.Add(CONST_VALURES.REDIS_COMMAND_PING); using (Result result =TcpClient.Send(cmd,client)) { } } Push(client); Available = true; } catch (Exception e_) { LastError = e_; Available = false; } Detecting = false; }
public IList <object> Sort(string key, int?offset, int?count, string BYpattern, string GETpattern, bool ALPHA, string STOREdestination, SortOrderType orderby, Type type, DataType dtype) { List <object> result = new List <object>(); using (RedisHost.ClientItem c = GetReader()) { using (Command cmd = new Command()) { cmd.Add(CONST_VALURES.REDIS_COMMAND_SORT); cmd.Add(key); if (!string.IsNullOrEmpty(BYpattern)) { cmd.Add("BY"); cmd.Add(BYpattern); } if (!string.IsNullOrEmpty(GETpattern)) { cmd.Add("GET"); cmd.Add(GETpattern); } if (offset != null) { cmd.Add("LIMIT"); cmd.Add(offset.Value.ToString()); cmd.Add(count == null?"1000":count.Value.ToString()); } if (ALPHA) { cmd.Add("ALPHA"); } cmd.Add(Enum.GetName(typeof(SortOrderType), orderby)); if (!string.IsNullOrEmpty(STOREdestination)) { cmd.Add("STORE"); cmd.Add(STOREdestination); } using (Result rd = TcpClient.Send(cmd, c.Client)) { foreach (ArraySegment <byte> item in rd.ResultDataBlock) { result.Add(FromRedis(item, dtype, type)); } } } } return(result); }