Beispiel #1
0
        static void Main(string[] args)
        {
            StringKey key    = "JOHN";
            string    Remark = "johnwonder";

            key.Set(Remark);
            Console.WriteLine(key.Get <string>());


            JsonKey  jk = "john_json";
            UserBase ub = new UserBase();

            ub.Name    = "john360";
            ub.City    = "wx";
            ub.Country = "cn";
            ub.Age     = 10;
            jk.Set(ub);

            Console.WriteLine(jk.Get <UserBase>().Name);
            //ProtobufList
            ProtobufKey rk = "john_protobuf";

            rk.Delete();
            UserBase1 userB = new UserBase1();

            userB.Name    = "john123";
            userB.City    = "wx";
            userB.Country = "cn";
            userB.Age     = 10;
            rk.Set(userB);

            Console.WriteLine(rk.Get <UserBase1>().Name);
            Console.ReadLine();
        }
Beispiel #2
0
        public void Set_GET_String()
        {
            StringKey key    = "HENRY";
            string    Remark = "henryfan gz cn 18 [email protected] 28304340";

            key.Set(Remark);
            Assert.AreEqual(Remark, key.Get <string>());
        }
Beispiel #3
0
        public void EXPIRE_TTL()
        {
            StringKey key = "HENRY_EMAIL";

            key.Set("*****@*****.**");
            key.Expire(800);
            long value = key.TTL();

            Assert.AreNotEqual(value, 0);
        }
Beispiel #4
0
        public void PEXPIRE_PTTL()
        {
            long      dt  = -1;
            StringKey key = "HENRY_EMAIL";

            key.Set("*****@*****.**");
            key.PExpire(2000);
            long value = key.PTTL();

            Assert.AreNotEqual(value, 0);
            System.Threading.Thread.Sleep(2000);
            value = key.PTTL();
            Assert.AreEqual(value, dt);
        }