public void Add(string item) { client.AddItemToSet(setId, item); }
private static void TestSet() { using (var client = new RedisClient("127.0.0.1", 6379)) { client.AddItemToSet("HQF.Tutorial.Redis:A", "B"); client.AddItemToSet("HQF.Tutorial.Redis:A", "C"); client.AddItemToSet("HQF.Tutorial.Redis:A", "D"); client.AddItemToSet("HQF.Tutorial.Redis:A", "E"); client.AddItemToSet("HQF.Tutorial.Redis:A", "F"); client.AddItemToSet("HQF.Tutorial.Redis:B", "C"); client.AddItemToSet("HQF.Tutorial.Redis:B", "F"); //求差集 Console.WriteLine("A,B集合差集"); client.GetDifferencesFromSet("HQF.Tutorial.Redis:A", "HQF.Tutorial.Redis:B").ToList<string>().ForEach(e => Console.Write(e + ",")); //求集合交集 Console.WriteLine("\nA,B集合交集"); client.GetIntersectFromSets(new string[] { "HQF.Tutorial.Redis:A", "HQF.Tutorial.Redis:B" }).ToList<string>().ForEach(e => Console.Write(e + ",")); //求集合并集 Console.WriteLine("\nA,B集合并集"); client.GetUnionFromSets(new string[] { "HQF.Tutorial.Redis:A", "HQF.Tutorial.Redis:B" }).ToList<string>().ForEach(e => Console.Write(e + ",")); } }