Example #1
0
 public CertApiConfig(ServiceCertType certtype)
 {
     certypetocon = new Dictionary <ServiceCertType, string>();
     certypetocon.Add(ServiceCertType.manage, "managetoken");
     certypetocon.Add(ServiceCertType.shop, "shoptoken");
     certypetocon.Add(ServiceCertType.user, "usertoken");
     _certtype = certtype;
 }
Example #2
0
 public CertApiConfig(ServiceCertType certtype)
 {
     certypetocon = new Dictionary<ServiceCertType, string>();
     certypetocon.Add(ServiceCertType.manage, "managetoken");
     certypetocon.Add(ServiceCertType.shop, "shoptoken");
     certypetocon.Add(ServiceCertType.user, "usertoken");
     _certtype = certtype;
 }
Example #3
0
 public CertCache(ServiceCertType certtype)
 {
     this.certtype = certtype;
     System.Runtime.Caching.MemoryCache mcache = System.Runtime.Caching.MemoryCache.Default;
     List<CertCacheItem> _tempmanagecache = mcache.Get(cachetypename) as List<CertCacheItem>;
     if (_tempmanagecache == null)
     {
         _tempmanagecache = new List<CertCacheItem>();
         bool r = mcache.Add(cachetypename, _tempmanagecache, new DateTimeOffset(DateTime.Now.AddMinutes(expiresminutes)));
         if (!r)
         {
             throw new Exception("初始化缓存失败。");
         }
     }
     tempmanagecache = _tempmanagecache.CloneList();
 }
Example #4
0
        public CertCache(ServiceCertType certtype)
        {
            this.certtype = certtype;
            System.Runtime.Caching.MemoryCache mcache = System.Runtime.Caching.MemoryCache.Default;
            List <CertCacheItem> _tempmanagecache     = mcache.Get(cachetypename) as List <CertCacheItem>;

            if (_tempmanagecache == null)
            {
                _tempmanagecache = new List <CertCacheItem>();
                bool r = mcache.Add(cachetypename, _tempmanagecache, new DateTimeOffset(DateTime.Now.AddMinutes(expiresminutes)));
                if (!r)
                {
                    throw new Exception("初始化缓存失败。");
                }
            }
            tempmanagecache = _tempmanagecache.CloneList();
        }