示例#1
0
        private Dictionary <string, string> RetrieveTermsCodeDict()
        {
            Dictionary <string, string> cachedDict = _customerCacheRepository.GetItem <Dictionary <string, string> >(CACHE_GROUPNAME, CACHE_PREFIX, CACHE_NAME, GetCacheKey("termCodes"));

            if (cachedDict == null)
            {
                Dictionary <string, string> termDict = _termRepo.ReadAll().ToDictionary(t => GetTermKey(t.BranchId, t.TermCode.ToString()), t => t.Description.Trim());

                _customerCacheRepository.AddItem <Dictionary <string, string> >(CACHE_GROUPNAME, CACHE_PREFIX, CACHE_NAME, GetCacheKey("termsCodes"), TimeSpan.FromHours(4), termDict);

                return(termDict);
            }
            else
            {
                return(cachedDict);
            }
        }