private List <ScreenEntity> GetCacheScreenRoles() { // Check the cache List <ScreenEntity> screenRoles = CacheLayer.Get <List <ScreenEntity> >(Constants.CacheKey.ScreenRoles); if (screenRoles == null) { _commonDataAccess = new CommonDataAccess(_context); List <ScreenEntity> screenList = _commonDataAccess.GetScreenList(); // Then add it to the cache so we // can retrieve it from there next time CacheLayer.Add(screenList, Constants.CacheKey.ScreenRoles); screenRoles = CacheLayer.Get <List <ScreenEntity> >(Constants.CacheKey.ScreenRoles); } return(screenRoles); }