CacheItemsUtils.cs 991 B

12345678910111213141516171819202122232425262728293031
  1. using FWindSoft.Data;
  2. using FWindSoft.SystemExtensions;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace Test.CacheItemsTest
  9. {
  10. public class CacheItemsUtils
  11. {
  12. public static void Test()
  13. {
  14. CacheItems<string,int> CacheItems = new CacheItems<string,int>((d) =>
  15. {
  16. return new Dictionary<string, int>() { { "1", 1 }, { "2", 2 } };
  17. }, (d) =>
  18. {
  19. return new Dictionary<string, int>() { { d.Split(':')[0], d.Split(':')[0].ToInt() } };
  20. },(d)=>d.Split(':')[0]);
  21. var result1 = CacheItems.GetItem("1");
  22. var result2 = CacheItems.GetItem("2");
  23. var result3 = CacheItems.GetItem("6");
  24. var result4 = CacheItems.GetItem("10");
  25. var result5 = CacheItems.GetItem("1");
  26. var result6 = CacheItems.GetItem("13:B");
  27. }
  28. }
  29. }