public List <Accretive_Locations> GetList_2() { string CacheKey = "Accretive.IDM.AccretiveLocations.CacheTableEx"; var collection = (List <Accretive_Locations>)DataCache.GetCache(CacheKey); if (collection == null || collection.Count == 0) { // Remove Cache based on Cache Key AppCache.ClearCache(CacheKey); //Retrieve the Data and place into cache IDataReader dr = (IDataReader)SqlHelper.ExecuteReader("", CommandType.StoredProcedure, "[dbo].[usp_LocationsList]"); DataTable cached = new DataTable(); cached.Load(dr); collection = (List <Accretive_Locations>)CBO.FillCollection <Accretive_Locations>(cached.CreateDataReader()); DataCache.SetCache(CacheKey, collection, TimeSpan.FromSeconds(120)); } return(collection); }
public List <Accretive_Locations> GetList_1() { string CacheKey = "Accretive.IDM.AccretiveLocations.CacheTable"; DataTable cached = (DataTable)DataCache.GetCache(CacheKey); if (cached == null) { IDataReader dr = (IDataReader)SqlHelper.ExecuteReader("", CommandType.StoredProcedure, "[dbo].[usp_LocationsList]"); cached = new DataTable(); cached.Load(dr); DataCache.SetCache(CacheKey, cached, CacheObject.GetTimeSpan(CacheObject.CacheLevel.Medium)); } var collection = (List <Accretive_Locations>)CBO.FillCollection <Accretive_Locations>(cached.CreateDataReader()); if (cached.Rows.Count == 0) { AppCache.ClearCache(CacheKey); } return(collection); }