public static List <TBMDomainQueryModel> GetDomains(CurrentUser currentUser) { string key = CacheKeyString.Domain; List <TBMDomainQueryModel> result = new List <TBMDomainQueryModel>(); var redis = CacheFactory.Instance(CacheType.Redis); if (redis.ContainsKey(key)) { result = redis.GetValueByKey <List <TBMDomainQueryModel> >(key); } else { bool postresult = RestfulApiClient.Post <bool>(RestfulApiClient.CacheUrl, "api/Cache/PostDomain", BuildToken(currentUser), null); if (postresult) { result = redis.GetValueByKey <List <TBMDomainQueryModel> >(key); } } return(result); }
public static List <TBMMaterialFileCacheModel> GetMaterial(CurrentUser currentUser) { string key = string.Format(CacheKeyString.Material, currentUser.CompanyID); List <TBMMaterialFileCacheModel> result = new List <TBMMaterialFileCacheModel>(); var redis = CacheFactory.Instance(CacheType.Redis); if (redis.ContainsKey(key)) { result = redis.GetValueByKey <List <TBMMaterialFileCacheModel> >(key); } else { bool postresult = RestfulApiClient.Post <bool>(RestfulApiClient.CacheUrl, "api/Cache/PostMaterial", BuildToken(currentUser), null); if (postresult) { result = redis.GetValueByKey <List <TBMMaterialFileCacheModel> >(key); } } return(result); }
public static List <ChinaAreaRecord> GetChinaArea(CurrentUser currentUser) { string key = CacheKeyString.ChinaArea; List <ChinaAreaRecord> result = new List <ChinaAreaRecord>(); var redis = CacheFactory.Instance(CacheType.Redis); if (redis.ContainsKey(key)) { result = redis.GetValueByKey <List <ChinaAreaRecord> >(key); } else { bool postresult = RestfulApiClient.Post <bool>(RestfulApiClient.CacheUrl, "api/Cache/PostArea", BuildToken(currentUser), null); if (postresult) { result = redis.GetValueByKey <List <ChinaAreaRecord> >(key); } } return(result); }