Beispiel #1
0
 //public static Boolean InfTableCacheRemoved = false;
 //public static System.Web.Caching.CacheItemRemovedReason InfTableCacheRemovedReason;
 private static void RemovedCallback(String k, Object v, System.Web.Caching.CacheItemRemovedReason r)
 {
     //InfTableCacheRemoved = true;
     //InfTableCacheRemovedReason = r;
     //LogHelper.WriteLog("CacheRemoved_"+k+"_" + r);
     //PubFunc.OperLog("缓存管理", "00", "admin", "CacheRemoved_" + k + "_" + r);
     RefreshTableConfig(k);
 }
Beispiel #2
0
 private void CacheItemExpired(string key, object value, System.Web.Caching.CacheItemRemovedReason reason)
 {
     //Mail atabilirsin
     //Veri tabanına yazabilirsin
     //uyarı mesajı verdirebilirsin
     //biz basit bir sekilde txt olusturup solution altındaki proje içerisinde oraya yazacağız birseyler.
     System.IO.File.WriteAllText(Server.MapPath("~/cache-expired-note.txt"), $"{key} cache item, {value.ToString()} cache item value are expired.Reason : {reason.ToString()}.");
 }//Cache silindikten sonra proje içinde txt oluşuyor.
 private static void Logout(string key, object value, System.Web.Caching.CacheItemRemovedReason reason)
 {
     //var cookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
     //if (key.Trim().Equals(cookie.Value.Trim()))
     //{
     //    FormsAuthentication.SignOut();
     //}
 }
 public override void RemovedCallback(string k, object v, System.Web.Caching.CacheItemRemovedReason r)
 {
     if (k == ACCOUNT_KEY && r == System.Web.Caching.CacheItemRemovedReason.Expired)
     {
         SaveDataCache(ACCOUNT_KEY, 0, 0, 2, v, autoReload: true);
     }
     base.RemovedCallback(k, v, r);
 }
 /// <summary>
 /// 缓存移除调用此方法
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 /// <param name="reason"></param>
 private static void RemoveCacheEvent(string key, object value, System.Web.Caching.CacheItemRemovedReason reason)
 {
     if (reason == System.Web.Caching.CacheItemRemovedReason.Removed || reason == System.Web.Caching.CacheItemRemovedReason.DependencyChanged)
     {
         if (key == "key3") //判断到期的key并按需进行操作
         {
         }
     }
 }
Beispiel #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="k"></param>
        /// <param name="v"></param>
        /// <param name="r"></param>
        public void CacheItemRemoved(string k, object v, System.Web.Caching.CacheItemRemovedReason r)
        {
            // Do a full pull of the guild
            using (Controllers.WGOController wgo = new Controllers.WGOController())
            {
                wgo.RetrieveGuild("Secondnorth", "Thrall");
            }

            // Re-add our task so it reoccurs
            AddReminderTask();
        }
Beispiel #7
0
 private static void CacheItemRemoved(string key, object value, System.Web.Caching.CacheItemRemovedReason reason)
 {
     if (Callbacks.ContainsKey(key))
     {
         if (String.IsNullOrEmpty(System.Threading.Thread.CurrentThread.Name))
         {
             System.Threading.Thread.CurrentThread.Name = key;
         }
         Callbacks[key].Invoke(GetKeyFromHostKey(key), value, reason, GetHostFromHostKey(key));
     }
 }
Beispiel #8
0
 /// <summary>
 /// Removes the bitmap from cache.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="o">The o.</param>
 /// <param name="reason">The reason.</param>
 public static void RemoveBitmapFromCache(string key, object o, System.Web.Caching.CacheItemRemovedReason reason)
 {
     if (o != null)
     {
         AjaxBitmap b = o as AjaxBitmap;
         if (b != null && b.bmp != null)
         {
             b.bmp.Dispose();
         }
     }
 }
        private void UpdatePersistentCacheCallback(string key, object value, System.Web.Caching.CacheItemRemovedReason reason)
        {
            SetupPersistentCacheUpdateProcess();

            // It only updates the persistent cache file when the reason is 'Expired'. This is because the cache item could be removed for other reasons, among them when the AppDomain is restarted (web.config modified, ...)
            if (reason == System.Web.Caching.CacheItemRemovedReason.Expired)
            {
                SavePersistentCache();
#if DEBUG
                LogHelper.Info <PersistentCacheController>("Routing persistent cache saved");
#endif
            }
        }
        private static void OnRemove(string key,
                                     object cacheItem,
                                     System.Web.Caching.CacheItemRemovedReason reason)
        {
            String test = reason.ToString();

            if (reason.ToString() == "Expired")
            {
                DtoEventos evento = (DtoEventos)cacheItem;

                guardarNotificacion(evento);
            }
        }
Beispiel #11
0
 /// <summary>
 /// 缓存项过期时程序模拟点击页面,阻止应用程序结束
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 /// <param name="reason"></param>
 private void CacheItemRemovedCallback(string key, object value, System.Web.Caching.CacheItemRemovedReason reason)
 {
     System.Net.WebClient client = new System.Net.WebClient();
     try
     {
         client.DownloadData("http://localhost:" + value.ToString() + "/Error.aspx");
     }
     catch (Exception ex)
     {
         //log4net.LogManager.GetLogger(this.GetType()).Error("唤醒页面" + "http://" + value.ToString() + "调用错误", ex);
         if (HttpContext.Current != null)
         {
             HttpContext.Current.Cache.Remove("TimerTaskNeedCache");
         }
     }
 }
Beispiel #12
0
 private static void OnCacheSuppress(string key, object value, System.Web.Caching.CacheItemRemovedReason reason)
 {
     log.Debug("Cache deleted: " + key + " reason: " + reason.ToString());
     try
     {
         DirectoryType dt = GetDirectory(key);
         if (dt != null)
         {
             log.Debug("Reinit directory cache...");
             if (HttpRuntime.Cache.Get(dt.name) == null)
             {
                 InitDirectoryCache();
             }
         }
     }
     catch (Exception e)
     {
         log.Debug("Unable to reinsert " + key + " object " + e.Message);
     }
 }
Beispiel #13
0
        private void OnRemoveCache(string cacheValue, object value, System.Web.Caching.CacheItemRemovedReason removeReason)
        {
            System.Collections.Hashtable cacheTable = (System.Collections.Hashtable)value;
            if (cacheTable == null)
            {
                return;
            }

            foreach (string chValue in cacheTable.Values)
            {
                if (chValue != null && chValue.IndexOf("savedtofile:") >= 0)
                {
                    string filePath = chValue.Replace("savedtofile:", "");
                    if (System.IO.File.Exists(filePath))
                    {
                        System.IO.File.Delete(filePath);
                    }
                }
            }
        }
Beispiel #14
0
        public void myCacheItemRemovedCallback(string key,
                                               object value, System.Web.Caching.CacheItemRemovedReason reason)
        {
            int?turnCounter;

            turnCounter = Application.Get("turnCounter") as Nullable <Int32>;

            if (turnCounter.HasValue && turnCounter < numberOfTurns)
            {
                RegisterCacheEntry(60);
            }
            else
            {
                Application.Set("turnCounter", null);
            }


            EmpiresInSpace.Server._60turns.newTurnServer();//Server.MapPath("~/pathdata.txt"));

            turnCounter = turnCounter + 1;
            Application.Set("turnCounter", turnCounter);
        }
 public void MyCallBackMethod(string s, object obj, System.Web.Caching.CacheItemRemovedReason reason)
 {
     Label1.Text = "MyCallBackMethod " + reason.ToString();
 }
 private static void cacheRemuved(string key, object value, System.Web.Caching.CacheItemRemovedReason reason)
 {
     dictunarySystem.Clear();
     dictunarySystem = dictSystemLogic.getDictionaryTerms();
     handleCache();
 }
 protected void ReloadPageRedirects(string key, object value, System.Web.Caching.CacheItemRemovedReason reason, string host)
 {
     SavePageRedirects((List <Error404Redirect>)value);
     LoadPageRedirects();
 }
Beispiel #18
0
 private static void Cache_onItemRemoved(string Key, object Value, System.Web.Caching.CacheItemRemovedReason Reason)
 {
     Debug.WriteLine("Key: " + Key + "; Reason=" + Reason.ToString(), "Cache");
 }
Beispiel #19
0
 /// <summary>
 /// Callback after removing a rate limit log from cache
 /// </summary>
 /// <param name="key">The cache key</param>
 /// <param name="value">The cache value</param>
 /// <param name="reason">The reason the cache item is being removed</param>
 public void RemoveLock(string key, object value, System.Web.Caching.CacheItemRemovedReason reason)
 {
     DynamicLock.Remove(CACHE_TYPE, _key);
     Cache.RemoveComponentCacheKey(key, value, reason);
 }
Beispiel #20
0
 private static void OnCacheSuppress(string key, object value, System.Web.Caching.CacheItemRemovedReason reason)
 {
     log.Debug("Privacy Cache deleted: " + key + " reason: " + reason.ToString());
 }
Beispiel #21
0
 private void CacheItemExpired(string key, object value, System.Web.Caching.CacheItemRemovedReason reason)
 {
     //Mail de atilabilir ..
     System.IO.File.WriteAllText(Server.MapPath("~/cache-expired-note.txt"), $"{key} cache item and {value.ToString()} cache item value are expired. Reason : {reason.ToString()}");
 }
Beispiel #22
0
 //***************************************************************************************************************************************
 public static void OnRemove(string key, object cacheItem, System.Web.Caching.CacheItemRemovedReason reason)
 {
     //When the cache expires then reload it from the API call.
     ModuleCatalogueCache.Instance.LoadModules();
 }
 private static void CacheRemovedCallback(string key, object value, System.Web.Caching.CacheItemRemovedReason reason)
 {
     lock (configCache) {
         configCache.Remove(key);
     }
 }
Beispiel #24
0
 public void RemovedCallback(string a, object o, System.Web.Caching.CacheItemRemovedReason reason)
 {
     //NCD.WebLog.SysWebLog.WriteLog("cacheOnRemove reason:" + reason.ToString());
 }