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; }
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; }
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(); }
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(); }