public void RefreshAuthType(string key, AuthTypeEnum authType) { if (key == null) { throw new ArgumentNullException("key"); } this.dict.Remove(key); AuthTypeCacheItem item = new AuthTypeCacheItem(); item.AuthTypeEnum = authType; item.ExpireDateTime = DateTime.Now.AddMinutes(basicExipreMinutes + rd.Next(-5, 5)); this.dict.Add(key, item); }
public AuthTypeEnum?GetAuthType(string key) { if (key == null) { throw new ArgumentNullException("key"); } if (this.dict.ContainsKey(key)) { AuthTypeCacheItem item = this.dict[key]; if (item.ExpireDateTime.CompareTo(DateTime.Now) > 0) { return(item.AuthTypeEnum); } } return(null); }