<>RedisSetService Class, please refer to the encapsulation in Article 1

redis data structure Set Use of
using (RedisSetService service = new RedisSetService()) { service.FlushAll();
// Clean up all data service.Add("advanced", "111"); service.Add("advanced", "112"); service
.Add("advanced", "114"); service.Add("advanced", "114"); service.Add("advanced",
"115"); service.Add("advanced", "115"); service.Add("advanced", "113"); var
result= service.GetAllItemsFromSet("advanced"); var random = service.
GetRandomItemFromSet("advanced");// Random access service.GetCount("advanced");// independent ip number
service.RemoveItemFromSet("advanced", "114"); { service.Add("begin", "111");
service.Add("begin", "112"); service.Add("begin", "115"); service.Add("end",
"111"); service.Add("end", "114"); service.Add("end", "113"); var result1 =
service.GetIntersectFromSets("begin", "end"); var result2 = service.
GetDifferencesFromSet("begin", "end"); var result3 = service.GetUnionFromSets(
"begin", "end"); } }
case
// duplicate removal :IP Statistical de duplication ; Add friend request ; Voting restrictions ; give the thumbs-up ; // The use of cross Union using (RedisSetService service = new
RedisSetService()) { service.FlushAll();// Clean up all data service.Add("XT", "Powell");
service.Add("XT", "Tenk"); service.Add("XT", "spider"); service.Add("XT",
"spider"); service.Add("XT", "spider"); service.Add("XT", "aaron"); service.Add(
"XT", "Linsan"); service.Add("Powell", "Eleven"); service.Add("Powell", "Tenk");
service.Add("Powell", "ywa"); service.Add("Powell", "Pang"); service.Add(
"Powell", "Jeff"); var result = service.GetIntersectFromSets("XT", "Powell");
var result2 = service.GetDifferencesFromSet("Powell", "XT"); var result3 =
service.GetDifferencesFromSet("XT", "Powell"); var result4=service.
GetUnionFromSets("XT", "Powell"); } /// <summary> /// Friend management Common friends - Possible understanding /// Find common friends :
/// Relational database : find 2 Friends list , And then compare it /// Second friend ( Possible understanding ): /// /// Since it is used Redis
Use it as much as possible Redis It's packaged inside Api; /// </summary> public static void Show() { using (
RedisSetService service = new RedisSetService()) { service.FlushAll(); service.
Add("xut", " Yunhuai "); service.Add("xut", "fresh"); service.Add("xut", " Tengkun "); service
.Add("xut", " A sense of belonging "); service.Add("xut", " Shakespeare "); service.Add("fresh", " awesome ");
service.Add("fresh", " Dream of tomorrow "); service.Add("fresh", " lollipop "); service.Add("fresh",
" put down "); service.Add("fresh", " Wechat in the sun "); service.Add("fresh", " Tengkun "); //1. Query common friends ;
Finding intersection var resut1 = service.GetIntersectFromSets("xut", "fresh");// //2. Friend recommendation / Probably know people
var resut2 = service.GetDifferencesFromSet("fresh", "xut");// var resut3 =
service.GetDifferencesFromSet("xut", "fresh");// var result4 = service.
GetUnionFromSets("xut", "fresh"); } }
<> Extended Edition
using (RedisSetService service = new RedisSetService()) { //key--values service
.KeyFulsh(); service.Add("Advanced", "111"); service.Add("Advanced", "112");
service.Add("Advanced", "113"); service.Add("Advanced", "115"); service.Add(
"Advanced", "114"); service.Add("Advanced", "111"); service.Add("Begin", "111");
service.Add("Begin", "112"); service.Add("Begin", "113"); service.Add("Begin",
"117"); service.Add("Begin", "116"); service.Add("Begin", "111"); service.Add(
"Internal", "111"); service.Add("Internal", "112"); service.Add("Internal",
"117"); service.Add("Internal", "119"); service.Add("Internal", "118"); service.
Add("Internal", "111"); var result = service.GetAllItemsFromSet("Advanced"); var
result2= service.GetRandomItemFromSet("Advanced"); result = service.
GetAllItemsFromSet("Begin"); result2 = service.GetRandomItemFromSet("Begin");
var result3 = service.GetIntersectFromSets("Advanced", "Begin");// hand over result3 =
service.GetDifferencesFromSet("Advanced", "Begin", "Internal");// difference result3 =
service.GetUnionFromSets("Advanced", "Begin", "Internal");// and service.
RemoveItemFromSet("Advanced", "111"); result = service.GetAllItemsFromSet(
"Advanced"); service.RandomRemoveItemFromSet("Advanced"); result = service.
GetAllItemsFromSet("Advanced"); }

Technology
©2019-2020 Toolsou All rights reserved,
Digital rolling lottery program Keras Save and load model (JSON+HDF5) Remember once EventBus Project issues caused by memory leaks I've been drinking soft water for three years ? What is the use of soft water and water softener msf Generate Trojan horse attack android mobile phone Time conversion front desk will 2020-07-17T03:07:02.000+0000 Into 2020-07-17 11:07:02 Chuan Shen 1190 Reverses the substring between each pair of parentheses leetcodehive Summary of processing methods for a large number of small files SparkSQL Achieve partition overlay write Image format conversion