private List <ParameterEntity> GetCacheParameters() { // Check the cache List <ParameterEntity> parameters = CacheLayer.Get <List <ParameterEntity> >(Constants.CacheKey.AllParameters); if (parameters == null) { _commonDataAccess = new CommonDataAccess(_context); List <ParameterEntity> lstParameter = _commonDataAccess.GetAllParameters(); // Then add it to the cache so we // can retrieve it from there next time CacheLayer.Add(lstParameter, Constants.CacheKey.AllParameters); parameters = CacheLayer.Get <List <ParameterEntity> >(Constants.CacheKey.AllParameters); } return(parameters); }