Exemple #1
0
 public object Clone()
 {
     CertCacheItem item = new CertCacheItem()
     {
         Token = this.Token.Clone() as AuthToken,
         apis = this.apis.CloneList() as List<api>
     };
     return item;
 }
Exemple #2
0
        public void DeleteToken(string token)
        {
            CertCacheItem item = GetCacheToken(token);

            if (item != null)
            {
                tempmanagecache.Remove(item);
                SetCertCahe();
            }
        }
Exemple #3
0
        public object Clone()
        {
            CertCacheItem item = new CertCacheItem()
            {
                Token = this.Token.Clone() as AuthToken,
                apis  = this.apis.CloneList() as List <api>
            };

            return(item);
        }
Exemple #4
0
        public bool SetCacheApis(string token, List <api> apis)
        {
            CertCacheItem item = GetCacheToken(token);

            if (item == null)
            {
                return(false);
            }
            item.apis = apis;
            SetCertCahe();
            return(true);
        }
Exemple #5
0
        public CertCacheItem GetCacheToken(string token)
        {
            CertCacheItem t_tokenitem = null;

            try
            {
                t_tokenitem = tempmanagecache.FirstOrDefault(x => x.Token.token == token);
                if (t_tokenitem == null)
                {
                    return(null);
                }
            }
            catch
            {
            }
            return(t_tokenitem);
        }
Exemple #6
0
        public void AddOrUpdateToken(AuthToken Token)
        {
            CertCacheItem t_tokenitem = null;

            Token.lastauth = DateTime.Now;//上次请求certcennt的时间。
            t_tokenitem    = tempmanagecache.FirstOrDefault(x => x.Token.token == Token.token);
            if (t_tokenitem == null)
            {
                tempmanagecache.Add(new CertCacheItem()
                {
                    Token = Token
                });
            }
            else
            {
                t_tokenitem.Token = Token;
            }
            SetCertCahe();
        }