public void ClearARP(int id) { ICacheDataProvider cacheRepository; if (Consts.DataCachingTechnology == DataCacheTechnology.MEMORYOBJECT) cacheRepository = new CacheDataProvider(); else cacheRepository = new AppFabricCacheProviderSystemRegions(Consts.ProductName); DataCacheObject dco = new DataCacheObject(DataCacheType.RESOURCE, DataCacheRegions.AUCTIONS, "GETAUCTIONDETAILRESULTPAST", new object[] { id }); cacheRepository.Remove(dco); Logger.LogInfo("[Cache removed: " + DataCacheType.RESOURCE + "_" + DataCacheRegions.AUCTIONS + "_GETAUCTIONDETAILRESULTPAST" + "_" + id + "]"); }
public void ClearAllCache() { ICacheDataProvider CacheRepository; List<string> keys = new List<string>(); if (Consts.DataCachingTechnology == DataCacheTechnology.MEMORYOBJECT) { CacheRepository = new CacheDataProvider(); keys = CacheRepository.Clear(); } else { CacheRepository = new AppFabricCacheProviderSystemRegions(Consts.ProductName); keys.AddRange((CacheRepository as AppFabricCacheProviderSystemRegions).Clear(DataCacheType.REFERENCE.ToString(), new List<string> { "CATEGORIES", "EVENTS", "TAGS" })); keys.AddRange((CacheRepository as AppFabricCacheProviderSystemRegions).Clear(DataCacheType.RESOURCE.ToString(), new List<string> { "EVENTS", "AUCTIONS", "IMAGES", "AUCTIONLISTS" })); keys.AddRange((CacheRepository as AppFabricCacheProviderSystemRegions).Clear(DataCacheType.ACTIVITY.ToString(), new List<string> { "WATCHLISTS", "EVENTREGISTRATIONS", "BIDS", "INVOICES" })); } StringBuilder sb = new StringBuilder(); sb.AppendLine("[ALL CACHE CLEARED: " + System.DateTime.Now + "]"); keys.ForEach(k => sb.AppendLine(k)); Logger.LogInfo(sb.ToString()); }