Exemplo n.º 1
0
        public string GetValueFromHash(string hashId, string key)
        {
            if (!this.IsValidField(key))
            {
                return(null);
            }

            RedisNativeClient client = this.pool.GetRedisClient(hashId);

            return((client == null) ? null : UTF8String.ToString(client.HGet(hashId, UTF8String.ToBytes(key))));
        }
Exemplo n.º 2
0
    protected void btnRedisHlook(object sender, EventArgs e)
    {
        RedisNativeClient rclient = new RedisNativeClient("192.168.1.207", 6379);
        string            key     = TextBox2.Text.Trim();

        byte[] keys   = System.Text.Encoding.Default.GetBytes(key);
        string field  = TextBox1.Text.Trim();
        string result = "";

        byte[] results = rclient.HGet(field, keys);
        try
        {
            result = System.Text.Encoding.Default.GetString(results);
            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>");
        }
    }