当前位置: 首页>>代码示例>>C#>>正文


C# CacheItemRemovedReason类代码示例

本文整理汇总了C#中CacheItemRemovedReason的典型用法代码示例。如果您正苦于以下问题:C# CacheItemRemovedReason类的具体用法?C# CacheItemRemovedReason怎么用?C# CacheItemRemovedReason使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CacheItemRemovedReason类属于命名空间,在下文中一共展示了CacheItemRemovedReason类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RebuildFromCacheHit

        /// <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;
        }
开发者ID:Aliceljm1,项目名称:kiss-project.web,代码行数:37,代码来源:ImageOptimizations.cs

示例2: onRemove

        //建立回调委托的一个实例
        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);
        }
开发者ID:yeyong,项目名称:manageserver,代码行数:31,代码来源:SASDataCache.cs

示例3: OnVideoCacheCleared

 private void OnVideoCacheCleared(string key, object value, CacheItemRemovedReason reason)
 {
     if (key.Equals("All"))
         CacheAll();
     else
         CacheCategory(key);
 }
开发者ID:BGorski90,项目名称:SoccerHighlightsStore,代码行数:7,代码来源:VideoCacheManager.cs

示例4: CacheItemRemoved

        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));
        }
开发者ID:shlee0817,项目名称:studmap,代码行数:7,代码来源:Global.asax.cs

示例5: RemovedCallback

 //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;
 }
开发者ID:Karolinebryn,项目名称:SampleCodeCertification70-487,代码行数:10,代码来源:Default.aspx.cs

示例6: RefreshActionData

 public RefreshActionData(ICacheItemRefreshAction refreshAction, string keyToRefresh, object removedData, CacheItemRemovedReason removalReason)
 {
     this.refreshAction = refreshAction;
     this.keyToRefresh = keyToRefresh;
     this.removalReason = removalReason;
     this.removedData = removedData;
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:7,代码来源:RefreshActionInvoker.cs

示例7: CacheItemRemoved

        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);
        }
开发者ID:TheBobo,项目名称:Dots,代码行数:30,代码来源:ChatHub.cs

示例8: RefreshData

        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
            {

            }

        }
开发者ID:shhyder,项目名称:application,代码行数:33,代码来源:Global.asax.cs

示例9: PerformScheduledTasks

        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();
        }
开发者ID:tony722,项目名称:MerchantTribe,代码行数:32,代码来源:Global.asax.cs

示例10: OnCacheItemRemoved

        private void OnCacheItemRemoved(string key, object value, CacheItemRemovedReason reason)
        {
            _onFileChanged(key);

            // We need to register again to get the next notification
            RegisterForNextNotification(key);
        }
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:FileChangeNotifier.cs

示例11: Signal

 public void Signal(string key, object value, CacheItemRemovedReason reason)
 {
     var virtualPath = Convert.ToString(value);
     var token = DetachToken(virtualPath);
     if (token != null)
         token.IsCurrent = false;
 }
开发者ID:mofashi2011,项目名称:orchardcms,代码行数:7,代码来源:WebSiteFolder.cs

示例12: Hit

        private static void Hit(string s, object o, CacheItemRemovedReason reason)
        {
            string path = ConfigurationManager.AppSettings["hitPath"];

            WebClient request = new WebClient();
            request.DownloadData(path);
        }
开发者ID:GuillaumeRoy,项目名称:Corrupto,代码行数:7,代码来源:Scheduler.cs

示例13: RemovedCallback

 /// <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... */ }
 }
开发者ID:JohnChantzis,项目名称:bark_GUI,代码行数:13,代码来源:TempFileDestructor.cs

示例14: CacheItemRemoved

        /// <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
                }
            }
        }
开发者ID:jh2mhs8,项目名称:Rock-ChMS,代码行数:36,代码来源:Global.asax.cs

示例15: CacheItemRemoved

 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));
 }
开发者ID:nikunj-prajapati,项目名称:loanprice,代码行数:7,代码来源:Global.asax.cs


注:本文中的CacheItemRemovedReason类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。