public void PushTest() { HQRedisService service = new HQRedisService("8.129.197.125", "Bus01#dwjwlxs", 0, false); HQRedisDB db = new HQRedisDB(service, 4); var comm = db.GetListComm <user>("userList"); user u1 = new user() { id = 1, money = 11.11, name = "b11" }; user u2 = new user() { id = 2, money = 22.22, name = "b22" }; user u3 = new user() { id = 3, money = 33.33, name = "b33" }; user u4 = new user() { id = 4, money = 44.44, name = "b44" }; user u5 = new user() { id = 5, money = 55.55, name = "b55" }; user u6 = new user() { id = 3, money = 33.33, name = "b33" }; var v1 = comm.Set(u1); var v2 = comm.Set(u2); var v3 = comm.Set(u3); var v4 = comm.Set(u4); var v5 = comm.Insert(true, u3, u5); var v6 = comm.Update(u3, 4); var v7 = comm.GetCount(); var v8 = comm.GetOne(4); var v9 = comm.GetRange(2, 4); var v10 = comm.Remove(2, u6); for (int i = 0; i < 20; i++) { var v11 = comm.GetAndRemoveFirst(); } }
public void GetDataTest() { user u1 = new user() { id = 1, money = 11.11, name = "老王老王老王老王老王老王老王老王老王老王" }; user u2 = new user() { id = 2, money = 22.22, name = "b22老张老张老张老张老张老张老张" }; user u3 = new user() { id = 3, money = 33.33, name = "b33老刘老刘老刘老刘老刘老刘老刘" }; user u4 = new user() { id = 4, money = 44.44, name = "b44老李老李老李老李老李老李" }; user u5 = new user() { id = 5, money = 55.55, name = "b55老黑老黑老黑老黑老黑老黑老黑" }; user u6 = new user() { id = 6, money = 66.66, name = "b66小王小王小王小王小王小王" }; user u7 = new user() { id = 7, money = 77.77, name = "b77小张小张小张小张小张小张" }; user u8 = new user() { id = 8, money = 88.88, name = "b88小李小李小李小李小李小李小李" }; user u9 = new user() { id = 9, money = 99.99, name = "b99小刘小刘小刘小刘小刘小刘小刘" }; HQRedisService service = new HQRedisService("8.129.197.125", "Bus01#dwjwlxs", 6379, false, "ObjectTest"); //HQRedisService service = new HQRedisService("192.168.18.115", null, 0, false); HQRedisDB db = new HQRedisDB(service, 4); var comm = db.GetObjectComm("user"); var comm2 = db.GetObjectComm("userfloat"); var comm3 = db.GetObjectComm("userInt"); var v1 = comm.SetData(u1); var v5 = comm3.IncrBy(3); var v52 = comm3.IncrBy(4); var v53 = comm3.IncrBy(5); var v62 = comm2.IncrByFloat(11.11f); var v63 = comm2.IncrByFloat(11.11f); var v64 = comm2.IncrByFloat(11.11f); var v42 = comm.GetRange(13, 37); var v4 = comm.GetRange(10, 20); var v2 = comm.GetData <user>(); var v3 = comm.GetLength(); var v6 = comm2.IncrByFloat(11.11f); var v7 = comm.MSET(("user2", u2), ("user3", u3), ("user4", u4), ("user5", u5), ("user6", u6)); var v8 = comm.MGET("user2", "user3", "user4", "user5"); //var v8 = comm.MGET("user2", "user3", "user4", "user5", "user6"); }
public void GetAllTest() { user u1 = new user() { id = 1, money = 11.11, name = "老王老王老王老王老王老王老王老王老王老王" }; user u2 = new user() { id = 2, money = 22.22, name = "b22老张老张老张老张老张老张老张" }; user u3 = new user() { id = 3, money = 33.33, name = "b33老刘老刘老刘老刘老刘老刘老刘" }; user u4 = new user() { id = 4, money = 44.44, name = "b44老李老李老李老李老李老李" }; user u5 = new user() { id = 5, money = 55.55, name = "b55老黑老黑老黑老黑老黑老黑老黑" }; user u6 = new user() { id = 6, money = 66.66, name = "b66小王小王小王小王小王小王" }; user u7 = new user() { id = 7, money = 77.77, name = "b77小张小张小张小张小张小张" }; user u8 = new user() { id = 8, money = 88.88, name = "b88小李小李小李小李小李小李小李" }; user u9 = new user() { id = 9, money = 99.99, name = "b99小刘小刘小刘小刘小刘小刘小刘" }; HQRedisService service = new HQRedisService("8.129.197.125", "Bus01#dwjwlxs", 0, false); HQRedisDB db = new HQRedisDB(service, 4); var comm = db.GetSortSetComm("userSortSet"); var comm3 = db.GetSortSetComm("userSortSet3"); var comm2 = comm as HQRedisSortSet; var v1 = comm.Set((11.11, u1)); var v2 = comm.Set((22.22, u2)); var v3 = comm.Set((33.33, u3)); var v4 = comm.Set((44.44, u4)); var v5 = comm.Set((55.55, u5)); var v6 = comm.Set((66.66, u6)); var v7 = comm.Set((77.77, u7)); var v35 = comm3.Set((55.55, u5)); var v36 = comm3.Set((66.66, u6)); var v37 = comm3.Set((77.77, u7)); var v38 = comm3.Set((88.88, u8)); var v39 = comm3.Set((99.99, u9)); var v10 = comm.GetAll <user>(); var v11 = comm.GetCount(); var v12 = comm.GetCount(2, 55); var v13 = comm.GetCount(u2, u4); var v14 = comm.GetIndexAsc(u4); var v15 = comm.GetIndexDesc(u4); var v16 = comm.GetRange <user>(u2, u6); var v17 = comm.GetRangeByIndex <user>(3, 7); var v18 = comm.GetRangeByScore <user>(3, 70); var v19 = comm.GetScore(u7); var v20 = comm.ZInterStore("userSortSet_ZInterStore", "userSortSet3"); //var v21 = comm.ZInterStore("userSortSet_GetZUNIONSTORE", "userSortSet2"); var v26 = comm.ZUnionStore("userSortSet_GetZUNIONSTORE", "userSortSet3"); var v22 = comm.ZIncrBy(u8, 1); var v23 = comm.Remove(u8); var v24 = comm.RemoveIndex(6, 9); var v25 = comm.RemoveScore(3, 30); }
public void GetOneTest() { HQRedisService service = new HQRedisService("8.129.197.125", "Bus01#dwjwlxs", 6379, false); HQRedisDB db = new HQRedisDB(service, 4); var comm3 = db.GetListComm("userList3"); comm3.Set("aaa111"); comm3.Set("aaa222"); comm3.Set("aaa333"); comm3.Set("aaa444"); comm3.Set("aaa555"); comm3.Set("aaa666"); var v31 = comm3.Insert(true, "aaa222", "aaa555"); var comm = db.GetListComm("userList"); user u1 = new user() { id = 1, money = 11.11, name = "老王老王老王老王老王老王老王老王老王老王" }; user u2 = new user() { id = 2, money = 22.22, name = "b22老张老张老张老张老张老张老张" }; user u3 = new user() { id = 3, money = 33.33, name = "b33老刘老刘老刘老刘老刘老刘老刘" }; user u4 = new user() { id = 4, money = 44.44, name = "b44老李老李老李老李老李老李" }; user u5 = new user() { id = 5, money = 55.55, name = "b55老黑老黑老黑老黑老黑老黑老黑" }; user u6 = new user() { id = 6, money = 66.66, name = "b66小王小王小王小王小王小王" }; user u7 = new user() { id = 7, money = 77.77, name = "b77小张小张小张小张小张小张" }; user u8 = new user() { id = 8, money = 88.88, name = "b88小李小李小李小李小李小李小李" }; user u9 = new user() { id = 9, money = 99.99, name = "b99小刘小刘小刘小刘小刘小刘小刘" }; var v1 = comm.Set(u1); var v2 = comm.Set(u2); var v3 = comm.Set(u3); var v4 = comm.Set(u4); var v11 = comm.Set(u5); var v12 = comm.Set(u6); var v13 = comm.Set(u7); var v14 = comm.Set(u8); var v5 = comm.Insert(true, u2, u9); var v6 = comm.Update(u3, 4); var v7 = comm.GetCount(); var v8 = comm.GetOne <user>(4); var v9 = comm.GetRange <user>(2, 4); var v10 = comm.Remove(2, u6); for (int i = 0; i < 20; i++) { var v21 = comm.GetAndRemoveFirst <user>(); } }
public HQRedisDB(HQRedisService Service, int DBIndex) { string connStr = $"{Service.Host}:{Service.Prot},defaultDatabase={DBIndex},password={Service.Password},prefix={Service.Prefix},ssl={Service.SSL},testcluster=false,poolsize=20,tryit=0"; DB = new CSRedis.CSRedisClient(connStr); }
public void DelTest() { user u1 = new user() { id = 1, money = 11.11, name = "老王老王老王老王老王老王老王老王老王老王" }; user u2 = new user() { id = 2, money = 22.22, name = "b22老张老张老张老张老张老张老张" }; user u3 = new user() { id = 3, money = 33.33, name = "b33老刘老刘老刘老刘老刘老刘老刘" }; user u4 = new user() { id = 4, money = 44.44, name = "b44老李老李老李老李老李老李" }; user u5 = new user() { id = 5, money = 55.55, name = "b55老黑老黑老黑老黑老黑老黑老黑" }; user u6 = new user() { id = 6, money = 66.66, name = "b66小王小王小王小王小王小王" }; user u7 = new user() { id = 7, money = 77.77, name = "b77小张小张小张小张小张小张" }; user u8 = new user() { id = 8, money = 88.88, name = "b88小李小李小李小李小李小李小李" }; user u9 = new user() { id = 9, money = 99.99, name = "b99小刘小刘小刘小刘小刘小刘小刘" }; HQRedisService service = new HQRedisService("8.129.197.125", "Bus01#dwjwlxs", 6379, false); //HQRedisService service = new HQRedisService("192.168.18.115", null, 0, false); HQRedisDB db = new HQRedisDB(service, 4); var comm2 = db.GetObjectComm("userKey2"); comm2.SetData(u2); var comm3 = db.GetObjectComm("userKey3"); comm3.SetData(u3); var comm4 = db.GetObjectComm("userKey4"); comm4.SetData(u4); var comm5 = db.GetObjectComm("userKey5"); comm5.SetData(u5); var comm6 = db.GetObjectComm("userKey6"); comm6.SetData(u6); var comm7 = db.GetObjectComm("userKey7"); comm7.SetData(u7); var comm = db.GetKeyComm(); var v1 = comm.Exists("userKey5"); var v2 = comm.Expire("userKey5", 20); var v3 = comm.Expire("userKey7", 200); var v4 = comm.ExpireAt("userKey6", DateTime.Now.AddSeconds(2000)); var v5 = comm.GetKeyType("userKey2"); var v6 = comm.Persist("userKey7"); var v7 = comm.PExpire("userKey7", 10000); var v10 = comm.Ttl("userKey6"); var v12 = comm.Ttl("userKey7"); //var v8 = comm.Rename("user2", "user2222eee"); var v9 = comm.SearchKeys("userKey*"); var v11 = comm.Del("userKey3", "userKey4"); }
public void GetAllKeysTest() { user u1 = new user() { id = 1, money = 11.11, name = "老王老王老王老王老王老王老王老王老王老王" }; user u2 = new user() { id = 2, money = 22.22, name = "b22老张老张老张老张老张老张老张" }; user u3 = new user() { id = 3, money = 33.33, name = "b33老刘老刘老刘老刘老刘老刘老刘" }; user u4 = new user() { id = 4, money = 44.44, name = "b44老李老李老李老李老李老李" }; user u5 = new user() { id = 5, money = 55.55, name = "b55老黑老黑老黑老黑老黑老黑老黑" }; user u6 = new user() { id = 6, money = 66.66, name = "b66小王小王小王小王小王小王" }; user u7 = new user() { id = 7, money = 77.77, name = "b77小张小张小张小张小张小张" }; user u8 = new user() { id = 8, money = 88.88, name = "b88小李小李小李小李小李小李小李" }; user u9 = new user() { id = 9, money = 99.99, name = "b99小刘小刘小刘小刘小刘小刘小刘" }; HQRedisService service = new HQRedisService("8.129.197.125", "Bus01#dwjwlxs", 0, false); HQRedisDB db = new HQRedisDB(service, 3); var comm = db.GetHashComm("userHash"); var comm2 = db.GetHashComm("userHashfloat"); var v1 = comm.HSet("user1", u1); var v21 = comm.HSet("user2", u2); var v3 = comm.HSet("user3", u3); var v4 = comm.HMSet(("user4", u4), ("user5", u5), ("user6", u6), ("user7", u7), ("user8", u8), ("user9", u9)); comm2.HMSet(("user10", 10)); comm2.HMSet(("user11", 11.11)); //var v5 = comm2.DB.DB.HSet("userHash", "user10", 10); //var v6 = comm2.DB.DB.HSet("userHash", "user11", 11.11); var v7 = comm.GetAllKeys(); var v8 = comm.GetKeyLength(); var v9 = comm.HDel("user2", "user4"); var v10 = comm.HExiste("user6"); var v11 = comm.HGet <user>("user7"); var v12 = comm.HGetAllData <user>(); var v13 = comm2.HIncrby("user10", 3); var v132 = comm2.HIncrby("user10", 4); var v133 = comm2.HIncrby("user10", 5); var v14 = comm2.HIncrByFloat("user11", 22.22); var v15 = comm.HMGet <user>("user7", "user8"); }
public void SetTest() { user u1 = new user() { id = 1, money = 11.11, name = "b11" }; user u2 = new user() { id = 2, money = 22.22, name = "b22" }; user u3 = new user() { id = 3, money = 33.33, name = "b33" }; user u4 = new user() { id = 4, money = 44.44, name = "b44" }; user u5 = new user() { id = 5, money = 55.55, name = "b55" }; user u6 = new user() { id = 6, money = 66.66, name = "b66" }; user u7 = new user() { id = 7, money = 77.77, name = "b77" }; user u8 = new user() { id = 8, money = 88.88, name = "b88" }; user u9 = new user() { id = 9, money = 99.99, name = "b99" }; HQRedisService service = new HQRedisService("8.129.197.125", "Bus01#dwjwlxs", 0, false); HQRedisDB db = new HQRedisDB(service, 4); var comm = db.GetSortSetComm <user>("userSortSet"); var comm2 = comm as HQRedisSortSet <user>; var v1 = comm.Set((11.11, u1)); var v2 = comm.Set((22.22, u2)); var v3 = comm.Set((33.33, u3)); var v4 = comm.Set((44.44, u4)); var v5 = comm.Set((55.55, u5)); var v6 = comm.Set((66.66, u6)); var v7 = comm.Set((77.77, u7)); var v8 = comm.Set((88.88, u8)); var v9 = comm.Set((99.99, u9)); comm2.Comm.ZAdd((22.33, "bb2233")); comm2.Comm.ZAdd((33.44, "bb3344")); comm2.Comm.ZAdd((44.55, "bb4455")); comm2.Comm.ZAdd((55.66, "bb5566")); comm2.Comm.ZAdd((66.77, "bb6677")); var vv2 = comm2.Comm.ZRangeByLex("[bb3344", "[bb5566", true).Result; var v10 = comm.GetAll(); var v11 = comm.GetCount(); var v12 = comm.GetCount(2, 55); //var v13 = comm.GetCount(u2, u4); var v14 = comm.GetIndexAsc(u4); var v15 = comm.GetIndexDesc(u4); var v16 = comm.GetRange(u2, u6); var v17 = comm.GetRangeByIndex(3, 7); var v18 = comm.GetRangeByScore(3, 6); var v19 = comm.GetScore(u7); var v20 = comm.ZInterStore("userSortSet_GetZINTERSTORE", "userSortSet2"); var v21 = comm.ZInterStore("userSortSet_GetZUNIONSTORE", "userSortSet2"); var v22 = comm.ZIncrBy(u8, 1); var v23 = comm.Remove(u8); var v24 = comm.RemoveIndex(6, 9); var v25 = comm.RemoveScore(5, 8); }
public void SetValueTest() { user u1 = new user() { id = 1, money = 11.11, name = "老王老王老王老王老王老王老王老王老王老王" }; user u2 = new user() { id = 2, money = 22.22, name = "b22" }; user u3 = new user() { id = 3, money = 33.33, name = "b33" }; user u4 = new user() { id = 4, money = 44.44, name = "b44" }; user u5 = new user() { id = 5, money = 55.55, name = "b55" }; user u6 = new user() { id = 6, money = 66.66, name = "b66" }; user u7 = new user() { id = 7, money = 77.77, name = "b77" }; user u8 = new user() { id = 8, money = 88.88, name = "b88" }; user u9 = new user() { id = 9, money = 99.99, name = "b99" }; //HQRedisService service = new HQRedisService("8.129.197.125", "Bus01#dwjwlxs", 0, false); HQRedisService service = new HQRedisService("192.168.18.115", null, 0, false); HQRedisDB db = new HQRedisDB(service, 4); var comm = db.GetObjectComm <user>("user"); var comm2 = db.GetObjectComm <float>("userfloat"); var v1 = comm.SetData(u1); //var v5 = comm2.INCRBY(3); var v62 = comm2.IncrByFloat(11.11f); var v63 = comm2.IncrByFloat(11.11f); var v64 = comm2.IncrByFloat(11.11f); var v42 = comm.GetRange(13, 37); var v4 = comm.GetRange(10, 20); var v2 = comm.GetData(); var v3 = comm.GetLength(); var v6 = comm2.IncrByFloat(11.11f); var v7 = comm.MSET(("user2", u2), ("user3", u3), ("user4", u4), ("user5", u5), ("user6", u6)); //var v8 = comm.MGET("user2", "user3", "user4", "user5", "user6"); }