善于使用HashSet和Dictionary使系统性能绝大的提升。

废话不说。直接上代码。

 

private static HashSet<string> hashSetLocationIds = new HashSet<string>();



string id = string.Format("{0}{1}{2}{3}{4}", 1,2,3,4).md5();

if (hashSetLocationIds.Contains(id)) return;
if (hashSetLocationIds.Count > 1x) hashSetLocationIds.Clear();
hashSetLocationIds.Add(id);

//you business code

  

2CPU+2G内存的低端入门级服务器配置。

 

 

 

 

 

end

 

posted @ 2023-01-17 15:18  liskov_design  阅读(35)  评论(0)    收藏  举报