示例#1
0
        static void StringTest(RedisDataBase db)
        {
            db.Set("yswenli", "good man");

            var val = db.Get("yswenli");

            var keys = db.Keys();

            db.Del("yswenli");

            var e = db.Exists("yswenli");

            db.Expire("saea", 60);

            db.Set("saea", "redis");

            db.ExpireAt("saea", DateTimeHelper.Now.AddSeconds(30));

            var t1 = db.Ttl("saea");

            db.Append("saea", " socket nibility");

            var v = db.Get("saea");

            var v1 = db.GetSet("saea", "redis socket");

            var r = db.RandomKey();

            db.Persist("saea");

            var t2 = db.Ttl("saea");

            var i1 = db.Increment("inc1");

            i1 = db.Increment("inc1");
            i1 = db.Increment("inc1");

            i1 = db.Decrement("inc1");
            i1 = db.Decrement("inc1");
            i1 = db.Decrement("inc1");

            var i2 = db.IncrementBy("inc2", 1);

            i2 = db.IncrementBy("inc2", 1);
            i2 = db.IncrementBy("inc2", 1);

            i2 = db.DecrementBy("inc2", 1);
            i2 = db.DecrementBy("inc2", 1);
            i2 = db.DecrementBy("inc2", 1);

            var i3 = db.IncrementByFloat("inc3", 0.1F);

            i3 = db.IncrementByFloat("inc3", 0.1F);
            i3 = db.IncrementByFloat("inc3", 0.1F);

            i3 = db.IncrementByFloat("inc3", -0.1F);
            i3 = db.IncrementByFloat("inc3", -0.1F);
            i3 = db.IncrementByFloat("inc3", -0.1F);

            var len = db.Len("saea");
        }