Ejemplo n.º 1
0
        private List <MenuEntity> GetCacheMainMenu()
        {
            // Check the cache
            List <MenuEntity> mainMenu = CacheLayer.Get <List <MenuEntity> >(Constants.CacheKey.MainMenu);

            if (mainMenu == null)
            {
                _commonDataAccess = new CommonDataAccess(_context);
                List <MenuEntity> menuItems = _commonDataAccess.GetMenuList();

                // Then add it to the cache so we
                // can retrieve it from there next time
                CacheLayer.Add(menuItems, Constants.CacheKey.MainMenu);
                mainMenu = CacheLayer.Get <List <MenuEntity> >(Constants.CacheKey.MainMenu);
            }

            return(mainMenu);
        }