• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CacheItemRemovedReason类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Reset

 public void Reset()
 {
     removedValue = "Known bad value";
     callbackHappened = false;
     callbackReason = CacheItemRemovedReason.Unknown;
     removedKey = null;
     instrumentationProvider = new NullCachingInstrumentationProvider();
 }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:8,代码来源:RefreshActionInvokerFixture.cs


示例17: Callback

 private void Callback(string key, object value, CacheItemRemovedReason reason)
 {
     if (reason == CacheItemRemovedReason.Expired)
     {
         FetchApplicationUrl();
         Insert();
     }
 }
开发者ID:danni95,项目名称:Core,代码行数:8,代码来源:KeepAlive.cs


示例18: RefreshActionData

 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;
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:8,代码来源:RefreshActionInvoker.cs


示例19: DoWork

 public void DoWork(string k, object v, CacheItemRemovedReason r)
 {
     if (!_stop)
     {
         _jobProvider.QueueScheduled();
         StartTimer(Convert.ToInt32(v));
     }
 }
开发者ID:Normmatt,项目名称:NzbDrone,代码行数:8,代码来源:WebTimer.cs


示例20: CachedItemRemoveCallBack

 private void CachedItemRemoveCallBack(string key, object value,
             CacheItemRemovedReason reason)
 {
     if (key == "Date1")
     {
         Cache.Remove("Date1");
     }
 }
开发者ID:rumbabu,项目名称:Yuvaas,代码行数:8,代码来源:CacheExample.aspx.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CacheList类代码示例发布时间:2022-05-24
下一篇:
C# CacheItemRemovedCallback类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap