コード例 #1
0
        private List <Country> GetGetCountryListFromCache()
        {
            const string key = "List_Country";

            object inCache = Cache.Get(key);

            if (inCache != null)
            {
                var listCountry = inCache as List <Country>;

                if (listCountry != null)
                {
                    return(listCountry);
                }
            }

            var listCountryNewest = _freightService.GetCountryList();

            if (listCountryNewest != null)
            {
                Cache.Add(key, listCountryNewest, 60);
            }

            return(listCountryNewest);
        }