public IDictionary <string, object> GetValuesMap(string[] keys, IRedisClient client) { RedisNativeClient cli = client as RedisNativeClient; if (keys == null) { throw new ArgumentNullException("keys"); } if (cli == null) { return(new Dictionary <string, object>()); } var resultBytesArray = cli.MGet(keys); var results = new Dictionary <string, object>(); for (var i = 0; i < resultBytesArray.Length; i++) { var key = keys[i]; var resultBytes = resultBytesArray[i]; if (resultBytes == null) { results.Add(key, null); } else { var resultString = resultBytes.FromUtf8Bytes(); var result = JsonSerializer.DeserializeFromString <string>(resultString); results.Add(key, result); } } return(results); }
protected void btnRedisMullook(object sender, EventArgs e) { RedisNativeClient rclient = new RedisNativeClient("192.168.1.207", 6379); string keys = mulget.Text; string[] keysval = keys.Split(';'); string result = ""; byte[][] results = rclient.MGet(keysval); try { foreach (byte[] re in results) { foreach (byte r in re) { result = result + Convert.ToString(r) + ';'; } } Response.Write("<script>window.alert('" + result + "');window.location.href='../Mem_RedisTest.aspx'</script>"); } catch { Response.Write("<script>window.alert('查询失败!');window.location.href='../Mem_RedisTest.aspx'</script>"); } }