Redis的数据类型
var client = new RedisClient("127.0.0.1", 6379); //client.Set<string>("name", "zhangsan"); //string name= client.Get<string>("name"); // client.Set<int>("age", 13); // Console.WriteLine(name); // client.SetEntryInHash("userId", "username1", "lisi"); // client.SetEntryInHash("userId", "age", "23"); //// List<string>list= client.GetHashKeys("userId"); // List<string> list = client.GetHashValues("userId"); // foreach (string key in list) // { // Console.WriteLine(key); // } //client.EnqueueItemOnList("userName", "wangwu");//入队(先进先出.) //client.EnqueueItemOnList("userName", "qianqi"); //int count=client.GetListCount("userName"); //for (var i = 0; i <count; i++) //{ // Console.WriteLine(client.DequeueItemFromList("userName"));//出队. //} //client.PushItemToList("name3", "maliu");//入栈 //client.PushItemToList("name3", "maliu333"); //int count = client.GetListCount("name3"); //for (var i = 0; i < count; i++) //{ // Console.WriteLine(client.PopItemFromList("name3"));//出栈 //} client.AddItemToSet("a3", "ddd"); client.AddItemToSet("a3", "ccc"); client.AddItemToSet("a3", "tttt"); client.AddItemToSet("a3", "sssh"); client.AddItemToSet("a3", "hhhh"); System.Collections.Generic.HashSet<string> hashset = client.GetAllItemsFromSet("a3"); foreach (string str in hashset) { Console.WriteLine(str); } Console.ReadKey();