ContainerCacheStrategyDomain.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using Senparc.CO2NET.Cache;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. namespace Senparc.Weixin.Cache
  7. {
  8. /// <summary>
  9. /// Container的领域缓存策略定义
  10. /// </summary>
  11. public class ContainerCacheStrategyDomain : ICacheStrategyDomain
  12. {
  13. #region 单例
  14. /// <summary>
  15. /// LocalCacheStrategy的构造函数
  16. /// </summary>
  17. ContainerCacheStrategyDomain() : base()
  18. {
  19. }
  20. //静态LocalCacheStrategy
  21. public static ICacheStrategyDomain Instance
  22. {
  23. get
  24. {
  25. return Nested.instance;//返回Nested类中的静态成员instance
  26. }
  27. }
  28. class Nested
  29. {
  30. static Nested()
  31. {
  32. }
  33. //将instance设为一个初始化的LocalCacheStrategy新实例
  34. internal static readonly ContainerCacheStrategyDomain instance = new ContainerCacheStrategyDomain();
  35. }
  36. #endregion
  37. private const string IDENTITY_NAME= "6526BBC0-718A-4F47-9675-D6DF6E1CE125";//固定值,请勿修改
  38. private const string DOMAIN_NAME = "WeixinContainer";//固定值,请勿修改。同时会作为缓存键命名空间的子级名称
  39. public string IdentityName { get { return IDENTITY_NAME; } }
  40. public string DomainName { get { return DOMAIN_NAME; } }
  41. }
  42. }