Esempio n. 1
0
 protected void btnRePend(object sender,EventArgs e)
 {
     RedisNativeClient rclient = new RedisNativeClient("192.168.1.207", 6379);
     string pkey = pendkey.Text.Trim();
     string select = Sele.Value;
     byte[] b = { 49, 50, 51 };
     if (select.Equals("Prepend"))
     {
             Response.Write("<script>window.alert('Redis无法向前追加数据!');window.location.href='../Mem_RedisTest.aspx'</script>");
     }
     else if (select.Equals("Append"))
     {
         try
         {
             if (rclient.Exists(pkey) == 1)
             {
                 rclient.Append(pkey, b);
                 Response.Write("<script>window.alert('追加数据成功!');window.location.href='../Mem_RedisTest.aspx'</script>");
             }
             else
                 Response.Write("<script>window.alert('追加数据失败!');window.location.href='../Mem_RedisTest.aspx'</script>");
         }
         catch
         {
             Response.Write("<script>window.alert('追加数据失败!');window.location.href='../Mem_RedisTest.aspx'</script>");
         }
     }
 }
Esempio n. 2
0
    public string ReMulGet(RedisNativeClient rc)
    {
        string keys = mulget.Text;

        string[] keysval = keys.Split(';');
        string   vals    = "";

        foreach (string singlekey in keysval)
        {
            try
            {
                if (rc.Exists(singlekey) == 1)
                {
                    vals = vals + rc.Get(singlekey) + ';';
                }
                else
                {
                    vals = vals + "ERROR!;";
                }
            }
            catch
            {
                vals = vals + "ERROR!";
            }
        }
        return(vals);
    }
Esempio n. 3
0
    protected void btnRedisLook(object sender, EventArgs e)
    {
        RedisNativeClient rclient = new RedisNativeClient("192.168.1.207", 6379);
        string            keyval  = key1.Text.Trim();

        if (rclient.Exists(keyval) == 0)
        {
            Response.Write("<script>window.alert('Key值不存在!');window.location.href='../Mem_RedisTest.aspx'</script>");
        }
        else if (rclient.Exists(keyval) == 1)
        {
            byte[] re     = rclient.Get(keyval);
            string result = "";
            foreach (byte r in re)
            {
                result = result + Convert.ToString(r);
            }
            Response.Write("<script>window.alert('" + result + "');window.location.href='../Mem_RedisTest.aspx'</script>");
        }
        else
        {
            Response.Write("<script>window.alert('ERROR!');window.location.href='../Mem_RedisTest.aspx'</script>");
        }
    }
Esempio n. 4
0
    protected void btnReDelete(object sender, EventArgs e)
    {
        RedisNativeClient rclient = new RedisNativeClient("192.168.1.207", 6379);
        string            keyval  = key2.Text.Trim();

        try
        {
            if (rclient.Exists(keyval) == 1)
            {
                rclient.Del(keyval);
                Response.Write("<script>window.alert('删除成功!');window.location.href='../Mem_RedisTest.aspx'</script>");
            }
            else
            {
                Response.Write("<script>window.alert('Key不存在!');window.location.href='../Mem_RedisTest.aspx'</script>");
            }
        }
        catch
        {
            Response.Write("<script>window.alert('删除失败!');window.location.href='../Mem_RedisTest.aspx'</script>");
        }
    }