Example #1
0
 public void AppendTest()
 {
     using (var mock = new MockConnector("MockHost", 9999, ":10\r\n"))
         using (var redis = new RedisClient(mock))
         {
             Assert.AreEqual(10, redis.Append("key", "x"));
             Assert.AreEqual("*3\r\n$6\r\nAPPEND\r\n$3\r\nkey\r\n$1\r\nx\r\n", mock.GetMessage());
         }
 }
Example #2
0
 public void AppendTest()
 {
     using (var mock = new FakeRedisSocket(":10\r\n"))
     using (var redis = new RedisClient(mock, new DnsEndPoint("fakehost", 9999)))
     {
         Assert.AreEqual(10, redis.Append("key", "x"));
         Assert.AreEqual("*3\r\n$6\r\nAPPEND\r\n$3\r\nkey\r\n$1\r\nx\r\n", mock.GetMessage());
     }
 }
Example #3
0
 public void AppendTest()
 {
     using(var mock = new MockConnector("localhost", 9999, ":10\r\n"))
     using(var redis = new RedisClient(mock))
     {
         Assert.Equal(10, redis.Append("key", "x"));
         Assert.Equal("*3\r\n$6\r\nAPPEND\r\n$3\r\nkey\r\n$1\r\nx\r\n", mock.GetMessage());
     }
 }
Example #4
0
 public void AppendTest()
 {
     using (var mock = new FakeRedisSocket(":10\r\n"))
         using (var redis = new RedisClient(mock, new DnsEndPoint("fakehost", 9999)))
         {
             Assert.Equal(10, redis.Append("key", "x"));
             Assert.Equal("*3\r\n$6\r\nAPPEND\r\n$3\r\nkey\r\n$1\r\nx\r\n", mock.GetMessage());
         }
 }
        public void Add(BaseInstruction instruction)
        {
            var key = new InstructionKeys ().GetIdsKey (instruction.TargetType, instruction.TargetId);

            var client = new RedisClient ();

            var stringToAppend = instruction.Id.ToString();

            if (client.Exists (key))
                stringToAppend = "." + stringToAppend;

            client.Append (key, stringToAppend);
        }
        public void Add(BaseInstruction instruction)
        {
            var key = new InstructionKeys().GetIdsKey(instruction.TargetType, instruction.TargetId);

            var client = new RedisClient();

            var stringToAppend = instruction.Id.ToString();

            if (client.Exists(key))
            {
                stringToAppend = "." + stringToAppend;
            }

            client.Append(key, stringToAppend);
        }
        //追加
        protected void Button8_Click(object sender, EventArgs e)
        {
            try
            {
                GetdbClient(out RedisClient dbclient);
                byte[] q = { 0, 2, 3, 4 };
                dbclient.Append("w1", q);
                dbclient.AppendToValue("w1", "test");
                dbclient.PrependItemToList("queue", "add");

                Response.Write("<script>alert('追加数据成功!')</script>");
            }
            catch (Exception ex)
            {
                Response.Write("追加数据失败!" + ex.Message);
            }
        }
Example #8
0
 public void Append(string key, string value)
 {
     Client.Append(key, Encoding.UTF8.GetBytes(value));
 }
Example #9
0
 public long StringAppend <T>(string key, T value)
 {
     return(database.Append(key, CtSharpRedisValue.SerializeRedisValue(value).Value));
 }
Example #10
0
 public int AppendCache(string key, byte[] bt)
 {
     return(redisClient.Append(key, bt));
 }