/// <summary> /// Called when the cache dependancy of a subdirectory of the root image folder is modified, created, or removed /// </summary> private static void RebuildFromCacheHit(string key, object value, CacheItemRemovedReason reason) { var data = (KeyValuePair<string, string>)value; string cssPath = data.Key; string path = data.Value; switch (reason) { case CacheItemRemovedReason.DependencyChanged: if (ProcessDirectory(cssPath, path, true)) { // Add the current directory back into the cache InsertItemIntoCache(cssPath, path); } break; // Cache items will only be manually removed if they have to be rebuilt due to changes in a folder that they inherit settings from case CacheItemRemovedReason.Removed: if (ProcessDirectory(cssPath, path, false)) { InsertItemIntoCache(cssPath, path); } break; case CacheItemRemovedReason.Expired: case CacheItemRemovedReason.Underused: // Don't need to reprocess parameters, just re-insert the item into the cache HttpRuntime.Cache.Insert(key, value, new CacheDependency(path), Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, RebuildFromCacheHit); break; default: break; } return; }
//建立回调委托的一个实例 public void onRemove(string key, object val, CacheItemRemovedReason reason) { switch (reason) { case CacheItemRemovedReason.DependencyChanged: break; case CacheItemRemovedReason.Expired: { //CacheItemRemovedCallback callBack = new CacheItemRemovedCallback(this.onRemove); //webCache.Insert(key, val, null, System.DateTime.Now.AddMinutes(TimeOut), // System.Web.Caching.Cache.NoSlidingExpiration, // System.Web.Caching.CacheItemPriority.High, // callBack); break; } case CacheItemRemovedReason.Removed: { break; } case CacheItemRemovedReason.Underused: { break; } default: break; } //如需要使用缓存日志,则需要使用下面代码 //myLogVisitor.WriteLog(this,key,val,reason); }
private void OnVideoCacheCleared(string key, object value, CacheItemRemovedReason reason) { if (key.Equals("All")) CacheAll(); else CacheCategory(key); }
public void CacheItemRemoved(string key, object value, CacheItemRemovedReason reason) { UserService.CheckActiveUsers(); // Neuen Task anlegen, damit dieser im nächsten Intervall wieder ausgeführt wird AddTask(key, Convert.ToInt32(value)); }
//TOTEST: set breakpoint here //Run solution and click AddItemToCache button //Either click RemoveItemFromCache button OR wait 60+ seconds and see that this event is fired public void RemovedCallback(string k, object v, CacheItemRemovedReason r) { itemRemoved = true; reason = r; //Callback cannot access placeholders in aspx file //lblResult.Text = "RemovedCallback event raised. Reason: " + reason; }
public void CacheItemRemoved(string k, object v, CacheItemRemovedReason r) { // do stuff here if it matches our taskname, like WebRequest // re-add our task so it recurs DateTime dt = DateTime.Now; Clients.All.keepMeAlive(); var turnamentsStars = context.Turnaments.Where(x => x.StartTime <= dt && x.IsSeatAndGo == false && !x.isStarted).ToList(); foreach (var turnament in turnamentsStars) { turnament.isStarted = true; context.SaveChanges(); for (int i = 0; i < turnament.Playes.Count / 2; i++) { var player1 = turnament.Playes[i]; var player2 = turnament.Playes[i + 1]; long gameId = DateTime.Now.Ticks; int rows = turnament.SizeX; int cols = turnament.SizeY; AcceptUserInvite(player1.DeviceId, player2.DeviceId, rows.ToString(), cols.ToString(), turnament.Id); //Clients.Client(player1.UserWebClientId).acceptInvite(player1.DeviceId, player2.DeviceId, rows, cols, gameId); //Clients.Client(player2.UserWebClientId).acceptInvite(player1.DeviceId, player2.DeviceId, rows, cols, gameId); } } int setNextTime = 60; AddTask(k, setNextTime); }
public void CacheItemRemoved(string k, object v, CacheItemRemovedReason r) { // do stuff here if it matches our taskname, like WebRequest // re-add our task so it recurs ReportHelper.GenerateAndSendDailyPDFReport(); AddTask(k, Convert.ToInt32(v)); }
static void PerformScheduledTasks(string key, Object value, CacheItemRemovedReason reason) { try { MerchantTribe.Commerce.RequestContext context = new MerchantTribe.Commerce.RequestContext(); MerchantTribeApplication app = MerchantTribe.Commerce.MerchantTribeApplication.InstantiateForDataBase(context); List<long> storeIds = app.ScheduleServices.QueuedTasks.ListStoresWithTasksToRun(); if (storeIds != null) { List<MerchantTribe.Commerce.Accounts.StoreDomainSnapshot> stores = app.AccountServices.Stores.FindDomainSnapshotsByIds(storeIds); if (stores != null) { System.Threading.Tasks.Parallel.ForEach(stores, CallTasksOnStore); //foreach (MerchantTribe.Commerce.Accounts.StoreDomainSnapshot snap in stores) //{ // string storekey = System.Configuration.ConfigurationManager.AppSettings["storekey"]; // string rootUrl = snap.RootUrl(); // string destination = rootUrl + "scheduledtasks/" + storekey; // MerchantTribe.Commerce.Utilities.WebForms.SendRequestByPost(destination, string.Empty); //} } } } catch { // suppress error and schedule next run } ScheduleTaskTrigger(); }
/// <summary> /// Called when object removed from cache /// </summary> /// <param name="k"></param> /// <param name="v"></param> /// <param name="r"></param> public void RemovedCallback(String k, Object v, CacheItemRemovedReason r) { try { File.Delete(fileName); } catch { /* nothing todo... */ } }
public void Signal(string key, object value, CacheItemRemovedReason reason) { var virtualPath = Convert.ToString(value); var token = DetachToken(virtualPath); if (token != null) token.IsCurrent = false; }
public static void RefreshData(String key, Object item, CacheItemRemovedReason reason) { try { lock (_cache) { BusinessLogic.Parameter.Parameter par = new BusinessLogic.Parameter.Parameter(); DataSet.DSParameter ds = par.GetParamerter(); System.TimeSpan span = new TimeSpan(0, 0, 30, 20, 0); //if( ds != null ) // _cache["data"] = ds; _cache.Insert("data", ds, null, Cache.NoAbsoluteExpiration, span, CacheItemPriority.High, new CacheItemRemovedCallback(RefreshData)); } } catch { } }
public RefreshActionData(ICacheItemRefreshAction refreshAction, string keyToRefresh, object removedData, CacheItemRemovedReason removalReason) { this.refreshAction = refreshAction; this.keyToRefresh = keyToRefresh; this.removalReason = removalReason; this.removedData = removedData; }
/// <summary> /// Caches the item removed. /// </summary> /// <param name="k">The k.</param> /// <param name="v">The v.</param> /// <param name="r">The r.</param> public void CacheItemRemoved( string k, object v, CacheItemRemovedReason r ) { try { if ( r == CacheItemRemovedReason.Expired ) { // call a page on the site to keep IIS alive string url = ConfigurationManager.AppSettings["BaseUrl"].ToString() + "KeepAlive.aspx"; WebRequest request = WebRequest.Create( url ); WebResponse response = request.GetResponse(); // add cache item again AddCallBack(); // process the transaction queue DrainTransactionQueue(); } } catch ( Exception ex ) { try { EventLog.WriteEntry( "Rock", string.Format( "Exception in Global.CacheItemRemoved(): {0}", ex.Message ), EventLogEntryType.Error ); } catch { // intentionally blank } } }
private static void Hit(string s, object o, CacheItemRemovedReason reason) { string path = ConfigurationManager.AppSettings["hitPath"]; WebClient request = new WebClient(); request.DownloadData(path); }
private void OnCacheItemRemoved(string key, object value, CacheItemRemovedReason reason) { _onFileChanged(key); // We need to register again to get the next notification RegisterForNextNotification(key); }
protected void ItemRemovedCallback(string key, object value, CacheItemRemovedReason reason) { if (key == "itemA" || key == "itemB") { Cache.Remove("itemA"); Cache.Remove("itemB"); } }
public RefreshActionData(ICacheItemRefreshAction refreshAction, string keyToRefresh, object removedData, CacheItemRemovedReason removalReason, CachingInstrumentationProvider instrumentationProvider) { this.refreshAction = refreshAction; this.keyToRefresh = keyToRefresh; this.removalReason = removalReason; this.removedData = removedData; this.instrumentationProvider = instrumentationProvider; }
public void Reset() { removedValue = "Known bad value"; callbackHappened = false; callbackReason = CacheItemRemovedReason.Unknown; removedKey = null; instrumentationProvider = new NullCachingInstrumentationProvider(); }
private void CachedItemRemoveCallBack(string key, object value, CacheItemRemovedReason reason) { if (key == "Date1") { Cache.Remove("Date1"); } }
public void DoWork(string k, object v, CacheItemRemovedReason r) { if (!_stop) { _jobProvider.QueueScheduled(); StartTimer(Convert.ToInt32(v)); } }
/// <summary> /// 自定义刷新操作 /// </summary> /// <param name="removedKey">移除的键</param> /// <param name="expiredValue">过期的值</param> /// <param name="removalReason">移除理由</param> void ICacheItemRefreshAction.Refresh(string removedKey, object expiredValue, CacheItemRemovedReason removalReason) { if (removalReason == CacheItemRemovedReason.Expired) { ICacheManager cache = CacheFactory.GetCacheManager(); cache.Add(removedKey, expiredValue); } }
private void Callback(string key, object value, CacheItemRemovedReason reason) { if (reason == CacheItemRemovedReason.Expired) { FetchApplicationUrl(); Insert(); } }
public void CacheItemRemoved(string k, object v, CacheItemRemovedReason r) { if (new ScheduleTask().IsEnableDownloadClean()) { Thread t = new Thread(new ThreadStart(new ScheduleTask().CleanDowloadedFile)); t.Start(); } AddTask(k, Convert.ToInt32(v)); }
private void Callback(string key, object value, CacheItemRemovedReason reason) { if (reason != CacheItemRemovedReason.Expired) return; lock (SyncObject) { AwardBadges(); } Insert(); }
public void CacheItemRemovedCallback( string key, object value, CacheItemRemovedReason reason) { System.Diagnostics.Debug.WriteLine("Cache item callback: " + DateTime.Now.ToString()); HitPage(); DailyTask(); }
public void Signal(string key, object value, CacheItemRemovedReason reason) { var virtualPath = Convert.ToString(value); Logger.Debug("Virtual path changed ({1}) '{0}'", virtualPath, reason.ToString()); var token = DetachToken(virtualPath); if (token != null) token.IsCurrent = false; }
public void TestInitialize() { inMemoryCache = new Hashtable(); instrumentationProvider = new CachingInstrumentationProvider(); expirer = new ExpirationTask(this, instrumentationProvider); expiredItemKeys = ""; callbackCount = 0; callbackReason = CacheItemRemovedReason.Unknown; }
public void CacheItemRemoved(string k, object v, CacheItemRemovedReason r) { // do stuff here if it matches our taskname, like WebRequest // re-add our task so it recurs using (FutureMeProductEntities ctx = new FutureMeProductEntities()) { try { DateTime now = DateTime.Now.Date; var ListMailsNotSend = ctx.MAILs.Where(x => x.Status == 0 && DbFunctions.TruncateTime(x.DeliverOn) == now).ToList(); if (ListMailsNotSend == null) { return; } SmtpClient mySmtpClient = new SmtpClient(); MailAddress from = new MailAddress("*****@*****.**", "Send2Future"); foreach(MAIL mail in ListMailsNotSend) { int status = mail.Status; // = 0 try { MailMessage email = new MailMessage(); email.From = from; email.To.Add(mail.EmailTo.Trim()); email.Subject = mail.Subject.Trim(); email.SubjectEncoding = System.Text.Encoding.UTF8; // set body-message and encoding email.Body = mail.Letter.Trim(); email.BodyEncoding = System.Text.Encoding.UTF8; // text or html email.IsBodyHtml = true; mySmtpClient.Send(email); status = 1; // send } catch (SmtpException ex) { status = 3; // send error //throw new ApplicationException("SmtpException has occured: " + ex.Message); } mail.Status = status; int affected = ctx.SaveChanges(); } } catch (Exception ex) { //throw ex; } } AddTask(k, Convert.ToInt32(v)); }
public void Refresh(string removedKey, object expiredValue, CacheItemRemovedReason removalReason) { var cacheManager = EnterpriseLibraryContainer.Current.GetInstance<ICacheManager>(); var fileContents = File.ReadAllText(_filename); var refreshAction = new FileRefreshAction(_filename); var expiration = new FileDependency(_filename); cacheManager.Add(removedKey, fileContents, CacheItemPriority.Normal, refreshAction, expiration); }
public void StartCacheProcesses() { sharedLock = new object(); callbackCount = 0; callbackReason = CacheItemRemovedReason.Unknown; exceptionMessage = ""; cacheManager = MockCacheManagerFactory.Create("ShortInMemoryPersistence", TestConfigurationSource.GenerateConfiguration()); }
private void cacheItemRemoved(string str, object obj, CacheItemRemovedReason cirr) { int bkhere = 3; }
/// <summary> /// One callback handler when remove one cache item from cache /// </summary> /// <param name="key"></param> /// <param name="value"></param> /// <param name="reason"></param> private static void onRemove(string key, object value, CacheItemRemovedReason reason) { System.Console.WriteLine("Remove cache key: " + key); System.Console.WriteLine("The reason: " + reason); }
public void RemovedCallback(String k, Object v, CacheItemRemovedReason r) { itemRemoved = true; reason = r; HttpContext.Current.Response.Write("事件已删除"); }
private void RootCacheItemRemoved(string key, object value, CacheItemRemovedReason reason) { _rootCacheKeyStored = false; }
private static void CacheItemRemoved(string cacheKey, object o, CacheItemRemovedReason cacheItemRemovedReason) { }
public void Refresh(string removedKey, object expiredValue, CacheItemRemovedReason removalReason) { Console.WriteLine("{0} --> {1} removed", removedKey, expiredValue); }
public void Show(string key, object value, CacheItemRemovedReason reason) { Cache.Insert(key, "新价值" + value); }
private void TriggerOnRemoveByHandle(TKey key, CacheItemRemovedReason reason, int level, object value) { NotNull(key, nameof(key)); OnRemoveByHandle?.Invoke(this, new CacheItemRemovedEventArgs <TKey>(key, reason, value, level)); }
public void RemovedPageIndexCallBack(string k, object v, CacheItemRemovedReason r) { cacheItemRemovedReason = r; #if (DEBUG) if (LogRemovedReason) { var log = new LogInfo { LogTypeKey = "HOST_ALERT" }; string itemName; string count; List <string> portalCounts = null; switch (k) { case "DNN_" + PageIndexKey: itemName = "Page Index"; //user profile actions try { DataCache.RemoveCache(UserProfileActionsKey); } catch (ConfigurationErrorsException) { //do nothing, this means the web.config file was overwritten, and thus the cache //was cleared. } if (v != null && v.GetType() == typeof(SharedDictionary <string, string>)) { count = "Item Count: " + ((SharedDictionary <string, string>)v).Values.Count.ToString(); } else { count = "N/a"; } break; case "DNN_" + UrlDictKey: itemName = "Friendly Url List"; if (v != null && v.GetType() == typeof(SharedDictionary <int, SharedDictionary <string, string> >)) { var friendlyUrls = (SharedDictionary <int, SharedDictionary <string, string> >)v; portalCounts = new List <string>(); using (friendlyUrls.GetReadLock()) { count = "Portal Count: " + friendlyUrls.Count.ToString(); foreach (int key in friendlyUrls.Keys) { SharedDictionary <string, string> portalUrls = friendlyUrls[key]; using (portalUrls.GetReadLock()) { portalCounts.Add("Portal " + key.ToString() + " Item Count :" + portalUrls.Count.ToString()); } } } } else { count = "N/a"; } break; default: itemName = "Url Rewriter Cache Item"; count = ""; break; } //add log values log.AddProperty("Url Rewriting Caching Message", itemName + " Cache item Removed."); log.AddProperty("Reason", cacheItemRemovedReason.ToString()); log.AddProperty("Cache Item Key", k); log.AddProperty("Item Count", count); if (portalCounts != null) { int i = 0; foreach (string item in portalCounts) { log.AddProperty("Item " + i.ToString(), item); i++; } } //System.Diagnostics.Trace.Assert(k != null, "k == " + k); LogController.Instance.AddLog(log); } #endif }
private void TriggerOnRemoveByHandle(string key, string region, CacheItemRemovedReason reason, int level, object value) { NotNullOrWhiteSpace(key, nameof(key)); OnRemoveByHandle?.Invoke(this, new CacheItemRemovedEventArgs(key, region, reason, value, level)); }
private void Callback(string key, object value, CacheItemRemovedReason reason) { OnChanged(null); }
public void RemovedCallback(String k, Object v, CacheItemRemovedReason r) { itemRemoved = true; reason = r; }
abstract public void WriteLog(DefaultCacheStrategy dcs, string key, object val, CacheItemRemovedReason reason);
public void TestTrigger(string key, string region, CacheItemRemovedReason reason, object value) { TriggerCacheSpecificRemove(key, region, reason, value); }
public void Refresh(string key, object expiredValue, CacheItemRemovedReason removalReason) { // Item has been removed from cache. Perform desired actions here, based upon // the removal reason (e.g. refresh the cache with the item). }
static void RemovedCallback(string key, object value, CacheItemRemovedReason reason) { Cache objCache = HttpRuntime.Cache; objCache.Insert("finallyChannge", value + "finally change"); }
/// <summary> /// Initializes a new instance of the <see cref="CacheItemRemovedEvent"/> class. /// </summary> /// <param name="key"> /// The key. /// </param> /// <param name="value"> /// The value. /// </param> /// <param name="reason"> /// The reason. /// </param> public CacheItemRemovedEvent([NotNull] string key, [NotNull] object value, CacheItemRemovedReason reason) { this.Key = key; this.Value = value; this.Reason = reason; }
private static void CacheItemRemoved(string sessionKey, Object value, CacheItemRemovedReason reason) { RemoveSession(sessionKey); }
public void Refresh(string removedKey, object expiredValue, CacheItemRemovedReason removalReason) { throw new Exception("Test exception from ExceptionThrowingMockRefreshAction"); }
private static void DependencyRemovedCallbackForFragment(string key, object value, CacheItemRemovedReason reason) { if (reason == CacheItemRemovedReason.DependencyChanged) { DependencyCacheEntry entry = value as DependencyCacheEntry; if (entry.OutputCacheEntryKey != null) { try { RemoveFragment(entry.OutputCacheEntryKey, entry.ProviderName); } catch (Exception exception) { HandleErrorWithoutContext(exception); } } } }
public void Refresh(string removedKey, object expiredValue, CacheItemRemovedReason removalReason) { ExpirationTaskFixture.callbackCount++; ExpirationTaskFixture.callbackReason = removalReason; }
/// <summary> /// 缓存删除之后调用方法 /// </summary> /// <param name="key"></param> /// <param name="value"></param> /// <param name="reason"></param> public void RemoveCallback(string key, object value, CacheItemRemovedReason reason) { }
private void RemovedCallback(string key, object value, CacheItemRemovedReason reason) { System.Threading.Thread.Sleep(s_WaitFileCloseTimeout); // 等待文件关闭 this.GetObject(); }
internal CacheEventArg(string key, string cachename, EventType eventType, EventCacheItem item, CacheEventDescriptor discriptor, CacheItemRemovedReason reason) : base(cachename, eventType, item) { _reason = reason; _descriptor = discriptor; }
internal override CacheEntry UpdateCache(CacheKey cacheKey, CacheEntry newEntry, bool replace, CacheItemRemovedReason removedReason, out object valueOld) { CacheEntry cacheEntry = null; CacheEntry key = null; CacheDependency dependency = null; bool flag4 = false; bool flag5 = false; DateTime minValue = DateTime.MinValue; CacheEntry.EntryState notInCache = CacheEntry.EntryState.NotInCache; bool flag6 = false; CacheItemRemovedReason removed = CacheItemRemovedReason.Removed; valueOld = null; bool flag2 = !replace && (newEntry == null); bool flag3 = !replace && (newEntry != null); Label_003E: if (flag4) { this.UpdateCache(cacheKey, null, true, CacheItemRemovedReason.Expired, out valueOld); flag4 = false; } cacheEntry = null; DateTime utcNow = DateTime.UtcNow; if ((this._useInsertBlock && (newEntry != null)) && newEntry.HasUsage()) { this.WaitInsertBlock(); } bool lockTaken = false; if (!flag2) { Monitor.Enter(this._lock, ref lockTaken); } try { cacheEntry = (CacheEntry)this._entries[cacheKey]; if (cacheEntry != null) { notInCache = cacheEntry.State; if (base._cacheCommon._enableExpiration && (cacheEntry.UtcExpires < utcNow)) { if (flag2) { if (notInCache == CacheEntry.EntryState.AddedToCache) { flag4 = true; goto Label_003E; } cacheEntry = null; } else { replace = true; removedReason = CacheItemRemovedReason.Expired; } } else { flag5 = base._cacheCommon._enableExpiration && (cacheEntry.SlidingExpiration > TimeSpan.Zero); } } if (!flag2) { if (replace && (cacheEntry != null)) { if (notInCache != CacheEntry.EntryState.AddingToCache) { key = cacheEntry; key.State = CacheEntry.EntryState.RemovingFromCache; this._entries.Remove(key); } else if (newEntry == null) { cacheEntry = null; } } if (newEntry != null) { bool flag9 = true; if ((cacheEntry != null) && (key == null)) { flag9 = false; removed = CacheItemRemovedReason.Removed; } if (flag9) { dependency = newEntry.Dependency; if ((dependency != null) && dependency.HasChanged) { flag9 = false; removed = CacheItemRemovedReason.DependencyChanged; } } if (flag9) { newEntry.State = CacheEntry.EntryState.AddingToCache; this._entries.Add(newEntry, newEntry); if (flag3) { cacheEntry = null; } else { cacheEntry = newEntry; } } else { if (!flag3) { cacheEntry = null; flag6 = true; } else { flag6 = cacheEntry == null; } if (!flag6) { newEntry = null; } } } } } finally { if (lockTaken) { Monitor.Exit(this._lock); } } if (flag2) { if (cacheEntry != null) { if (flag5) { minValue = utcNow + cacheEntry.SlidingExpiration; if (((minValue - cacheEntry.UtcExpires) >= CacheExpires.MIN_UPDATE_DELTA) || (minValue < cacheEntry.UtcExpires)) { this._expires.UtcUpdate(cacheEntry, minValue); } } this.UtcUpdateUsageRecursive(cacheEntry, utcNow); } if (cacheKey.IsPublic) { PerfCounters.IncrementCounter(AppPerfCounter.API_CACHE_RATIO_BASE); if (cacheEntry != null) { PerfCounters.IncrementCounter(AppPerfCounter.API_CACHE_HITS); } else { PerfCounters.IncrementCounter(AppPerfCounter.API_CACHE_MISSES); } } PerfCounters.IncrementCounter(AppPerfCounter.TOTAL_CACHE_RATIO_BASE); if (cacheEntry != null) { PerfCounters.IncrementCounter(AppPerfCounter.TOTAL_CACHE_HITS); return(cacheEntry); } PerfCounters.IncrementCounter(AppPerfCounter.TOTAL_CACHE_MISSES); return(cacheEntry); } int num = 0; int num2 = 0; int delta = 0; int num4 = 0; if (key != null) { if (key.InExpires()) { this._expires.Remove(key); } if (key.InUsage()) { this._usage.Remove(key); } key.State = CacheEntry.EntryState.RemovedFromCache; valueOld = key.Value; num--; delta++; if (key.IsPublic) { num2--; num4++; } } if (newEntry != null) { if (flag6) { newEntry.State = CacheEntry.EntryState.RemovedFromCache; newEntry.Close(removed); newEntry = null; } else { if (base._cacheCommon._enableExpiration && newEntry.HasExpiration()) { this._expires.Add(newEntry); } if ((base._cacheCommon._enableMemoryCollection && newEntry.HasUsage()) && ((!newEntry.HasExpiration() || (newEntry.SlidingExpiration > TimeSpan.Zero)) || ((newEntry.UtcExpires - utcNow) >= CacheUsage.MIN_LIFETIME_FOR_USAGE))) { this._usage.Add(newEntry); } newEntry.State = CacheEntry.EntryState.AddedToCache; num++; delta++; if (newEntry.IsPublic) { num2++; num4++; } } } if (key != null) { key.Close(removedReason); } if (newEntry != null) { newEntry.MonitorDependencyChanges(); if ((dependency != null) && dependency.HasChanged) { base.Remove(newEntry, CacheItemRemovedReason.DependencyChanged); } } switch (num) { case 1: Interlocked.Increment(ref this._totalCount); PerfCounters.IncrementCounter(AppPerfCounter.TOTAL_CACHE_ENTRIES); break; case -1: Interlocked.Decrement(ref this._totalCount); PerfCounters.DecrementCounter(AppPerfCounter.TOTAL_CACHE_ENTRIES); break; } switch (num2) { case 1: Interlocked.Increment(ref this._publicCount); PerfCounters.IncrementCounter(AppPerfCounter.API_CACHE_ENTRIES); break; case -1: Interlocked.Decrement(ref this._publicCount); PerfCounters.DecrementCounter(AppPerfCounter.API_CACHE_ENTRIES); break; } if (delta > 0) { PerfCounters.IncrementCounterEx(AppPerfCounter.TOTAL_CACHE_TURNOVER_RATE, delta); } if (num4 > 0) { PerfCounters.IncrementCounterEx(AppPerfCounter.API_CACHE_TURNOVER_RATE, num4); } return(cacheEntry); }
/// <summary> /// Callback method used when Cached ad users are removed. /// </summary> /// <remarks> /// This method simply re-fetches the removed collection causing an updated /// version to be re-cached. /// </remarks> /// <param name="key">The key.</param> /// <param name="usersForGroup">The users for group.</param> /// <param name="reason">The reason.</param> public static void CachedAdUsersForGroupRemovedCallback(string key, object usersForGroup, CacheItemRemovedReason reason) { GetCachedAdUsersForGroup(GetAdUserGroupFromCacheKey(key)); }
void ICacheItemRefreshAction.Refresh(string removedKey, object expiredValue, CacheItemRemovedReason removalReason) { if (removalReason == 0) { if (removedKey == "ProvinceCache") { Service.GetCacheHelp().AddFile("ProvinceCache", CacheData.SelectProvince(), Service.GetAppHelp().GetAppSetting("ProvinceCache")); Console.Write("更新省缓存"); } else if (removedKey == "CityCache") { Service.GetCacheHelp().AddFile("CityCache", CacheData.SelectCity(), Service.GetAppHelp().GetAppSetting("CityCache")); Console.Write("更新市缓存"); } else if (removedKey == "CountyCache") { Service.GetCacheHelp().AddFile("CountyCache", CacheData.SelectCounty(), Service.GetAppHelp().GetAppSetting("CountyCache")); Console.Write("更新区缓存"); } else if (removedKey == "MenuCache") { Service.GetCacheHelp().AddFile("MenuCache", CacheData.SelectMenu(), Service.GetAppHelp().GetAppSetting("MenuCache")); Console.Write("更新菜单缓存"); } else if (removedKey == "StationCache") { Service.GetCacheHelp().AddFile("StationCache", CacheData.SelectStation(), Service.GetAppHelp().GetAppSetting("StationCache")); Console.Write("更新网点缓存"); } else if (removedKey == "EunmCache") { Service.GetCacheHelp().AddFile("EunmCache", CacheData.SelectEunm(), Service.GetAppHelp().GetAppSetting("EunmCache")); Console.Write("更新枚举缓存"); } } }
//callback private static void ReCargarConfigFile(string key, object value, CacheItemRemovedReason reason) { CargarSiteReaderEnCache(); }
public void Refresh(string removedKey, object expiredValue, CacheItemRemovedReason removalReason) { }