Пример #1
0
 public HomeController(CacheDataModel cacheDataModel, SecurityProvider securityProvider, ConfigurationProvider configurationProvider, IMapper mapper, IOwinContext owinContext)
 {
     this.mapper                = mapper;
     this.owinContext           = owinContext;
     this.securityProvider      = securityProvider;
     this.configurationProvider = configurationProvider;
 }
Пример #2
0
 public void AddAndDelete(string key, CachedResponse value, TimeSpan ttl, string region)
 {
     keys[key] = new CacheDataModel()
     {
         CacheResponse = value,
         Region        = region,
         Timeout       = DateTime.Now.Add(ttl)
     };
 }
Пример #3
0
 public void AddAndDelete(string key, CachedResponse value, TimeSpan ttl, string region)
 {
     Console.WriteLine($"This is {nameof(CustomCacheExtend)}.{nameof(AddAndDelete)}");
     CustomCacheExtendDictionary[key] = new CacheDataModel()
     {
         CachedResponse = value,
         Region         = region,
         Timeout        = DateTime.Now.Add(ttl)
     };
 }
Пример #4
0
 public void Add(string key, CachedResponse value, TimeSpan ttl, string region)
 {
     Console.WriteLine($"This is {nameof(CustomCache)}--{nameof(Add)}");
     CustomCacheDictionary[key] = new CacheDataModel()
     {
         CachedResponses = value,
         TimeOut         = DateTime.Now.Add(ttl),
         Region          = region
     };
 }
Пример #5
0
        protected override void Load(ContainerBuilder builder)
        {
            IList <RoleAccessCacheModel> roleAccessCacheData = GetRoleAccessCacheData();

            CacheDataModel cacheData = new CacheDataModel(roleAccessCacheData);

            builder.RegisterInstance(cacheData).As <CacheDataModel>().SingleInstance();

            base.Load(builder);
        }
Пример #6
0
 /// <summary>
 /// 没做过期清理  所以需要
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 /// <param name="ttl"></param>
 /// <param name="region"></param>
 public void Add(string key, CachedResponse value, TimeSpan ttl, string region)
 {
     Console.WriteLine($"This is {nameof(CustomCache)}.{nameof(Add)}");
     //CustomCacheDictionary.Add(key, new CacheDataModel()
     //{
     //    CachedResponse = value,
     //    Region = region,
     //    Timeout = DateTime.Now.Add(ttl)
     //});
     CustomCacheDictionary[key] = new CacheDataModel()
     {
         CachedResponse = value,
         Region         = region,
         Timeout        = DateTime.Now.Add(ttl)
     };
 }