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


C# CacheItemPriority类代码示例

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


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

示例1: Insert

		public static void Insert(string key, object value, CacheDependency dependency, TimeSpan timeframe, CacheItemPriority priority)
		{
			if (value != null)
			{
				_cache.Insert(key, value, dependency, DateTime.Now.Add(timeframe), Cache.NoSlidingExpiration, priority, null);
			}
		}
开发者ID:Wdovin,项目名称:vc-community,代码行数:7,代码来源:WFFileSystemWorkflowActivityProvider.cs

示例2: CacheItem

		/// <summary>Costructor</summary>
		/// <param name="value">Actual object to be stored in cache</param>
		public CacheItem(object value)
		{
			_v = value;
			_abs = Cache.NoAbsoluteExpiration;
		    _sld = Cache.NoSlidingExpiration;
			_p = CacheItemPriority.Default;
		}
开发者ID:christrotter,项目名称:NCache,代码行数:9,代码来源:CacheItem.cs

示例3: SetPriority

 /// <summary>
 /// Sets the priority for keeping the cache entry in the cache during a memory pressure tokened cleanup.
 /// </summary>
 /// <param name="options"></param>
 /// <param name="priority"></param>
 public static MemoryCacheEntryOptions SetPriority(
     this MemoryCacheEntryOptions options,
     CacheItemPriority priority)
 {
     options.Priority = priority;
     return options;
 }
开发者ID:benaadams,项目名称:Caching,代码行数:12,代码来源:MemoryCacheEntryExtensions.cs

示例4: AddCommand

        internal AddCommand(string key, byte[] value, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, short removeCallback, short updateCallback, Hashtable queryInfo, BitSet flagMap, string cacheId,EventDataFilter updateDataFilter,EventDataFilter removeDataFilter)
        {
            base.name = "AddCommand";
            base.key = key;

            _addCommand = new Alachisoft.NCache.Common.Protobuf.AddCommand();

            if (absoluteExpiration != Cache.NoAbsoluteExpiration)
                _addCommand.absExpiration = absoluteExpiration.Ticks;

            if (slidingExpiration != Cache.NoSlidingExpiration)
                _addCommand.sldExpiration = slidingExpiration.Ticks;

            Alachisoft.NCache.Caching.UserBinaryObject ubObject = Alachisoft.NCache.Caching.UserBinaryObject.CreateUserBinaryObject(value);

            _addCommand.key = key;
            _addCommand.data.AddRange(ubObject.DataList);
            _addCommand.requestId = base.RequestId;
            _addCommand.updateCallbackId = updateCallback;
            _addCommand.removeCallbackId = removeCallback;
            _addCommand.priority = (int)priority;
            _addCommand.flag = flagMap.Data;
            _addCommand.updateDataFilter = (short)updateDataFilter;
            _addCommand.removeDataFilter = (short)removeDataFilter;

            // Changes made to send Queries, Tags and NamgedTags in a single object
            ObjectQueryInfo objectQueryInfo = new ObjectQueryInfo();

            if (queryInfo["query-info"] != null)
                objectQueryInfo.queryInfo = ProtobufHelper.GetQueryInfoObj(queryInfo["query-info"] as Hashtable);

                _addCommand.objectQueryInfo = objectQueryInfo;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:33,代码来源:AddCommand.cs

示例5: CacheItemArgs

 public CacheItemArgs(string key)
 {
     _CacheKey = key;
     _CacheTimeOut = 20;
     _CachePriority = CacheItemPriority.Default;
     //_ParamList = new ArrayList();
 }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:7,代码来源:CacheItemArgs.cs

示例6: InsertCommand

        public InsertCommand(string key, byte[] value, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, short removeCallback, short updateCallback, Hashtable queryInfo, BitSet flagMap, object lockId, LockAccessType accessType, string cacheId, EventDataFilter updateCallbackFilter, EventDataFilter removeCallabackFilter)
        {
            base.name = "InsertCommand";
            base.key = key;

            _insertCommand = new Alachisoft.NCache.Common.Protobuf.InsertCommand();
            _insertCommand.key = key;

            Alachisoft.NCache.Caching.UserBinaryObject ubObject = UserBinaryObject.CreateUserBinaryObject(value);
            _insertCommand.data.AddRange(ubObject.DataList);

            _insertCommand.requestId = base.RequestId;
            _insertCommand.removeCallbackId = removeCallback;
            _insertCommand.updateCallbackId = updateCallback;
            _insertCommand.updateDataFilter = (short)updateCallbackFilter;
            _insertCommand.removeDataFilter = (short)removeCallabackFilter;
            _insertCommand.priority = (int)priority;
            _insertCommand.flag = flagMap.Data;
            if(lockId != null) _insertCommand.lockId = lockId.ToString();
            _insertCommand.lockAccessType = (int)accessType;

            if (absoluteExpiration != Web.Caching.Cache.NoAbsoluteExpiration)
                _insertCommand.absExpiration = absoluteExpiration.Ticks;

            if (slidingExpiration != Web.Caching.Cache.NoSlidingExpiration)
            _insertCommand.sldExpiration = slidingExpiration.Ticks;

            ObjectQueryInfo objectQueryInfo = new ObjectQueryInfo();

            if (queryInfo["query-info"] != null)
                objectQueryInfo.queryInfo = ProtobufHelper.GetQueryInfoObj(queryInfo["query-info"] as Hashtable);

                _insertCommand.objectQueryInfo = objectQueryInfo;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:34,代码来源:InsertCommand.cs

示例7: Insert

 public static void Insert(string key, object obj, CacheDependency dep, int seconds, CacheItemPriority priority)
 {
     if (obj != null)
     {
         _cache.Insert(key, obj, dep, DateTime.Now.AddSeconds((double) (Factor * seconds)), TimeSpan.Zero, priority, null);
     }
 }
开发者ID:huaminglee,项目名称:myyyyshop,代码行数:7,代码来源:DataCache.cs

示例8: CacheItem

        /// <summary>
        /// Constructs a fully formed CacheItem. This constructor is to be used when restoring an existing
        /// CacheItem from the backing store. As such, it does not generate its own Guid for this instance,
        /// but allows the guid to be passed in, as read from the backing store.
        /// </summary>
        /// <param name="lastAccessedTime">Time this CacheItem last accessed by user.</param>
        /// <param name="key">Key provided  by the user for this cache item. May not be null.</param>
        /// <param name="value">Value to be stored. May be null.</param>
		/// <param name="scavengingPriority">Scavenging priority of CacheItem. See <see cref="CacheItemPriority" /> for values.</param>
        /// <param name="refreshAction">Object supplied by caller that will be invoked upon expiration of the CacheItem. May be null.</param>
		/// <param name="expirations">Param array of ICacheItemExpiration objects. May provide 0 or more of these.</param>
        public CacheItem(DateTime lastAccessedTime, string key, object value, CacheItemPriority scavengingPriority, ICacheItemRefreshAction refreshAction, params ICacheItemExpiration[] expirations)
        {
            Initialize(key, value, refreshAction, scavengingPriority, expirations);

            TouchedByUserAction(false, lastAccessedTime);
            InitializeExpirations();
        }
开发者ID:wuyingyou,项目名称:uniframework,代码行数:18,代码来源:CacheItem.cs

示例9: AddCache

 /// <summary>
 /// 建立定时不访问便移除的缓存
 /// </summary>
 public static object AddCache(string key, object value, TimeSpan slidingExpiration, CacheItemPriority priority)
 {
     if (HttpRuntime.Cache[key] == null && value != null)
         return HttpRuntime.Cache.Add(key, value, null, Cache.NoAbsoluteExpiration, slidingExpiration, priority, null);
     else
         return null;
 }
开发者ID:pyfxl,项目名称:fxlweb,代码行数:10,代码来源:CacheHelper.cs

示例10: Insert

 public void Insert(string key, object value, CacheDependency dependencies,
     DateTime absoluteExpiration, TimeSpan slidingExpiration,
     CacheItemPriority priority, CacheItemRemovedCallback onRemoveCallback)
 {
     _cache.Insert(key, value, dependencies, absoluteExpiration, slidingExpiration,
         priority, onRemoveCallback);
 }
开发者ID:jammycakes,项目名称:dolstagis.ideas,代码行数:7,代码来源:HttpRuntimeCache.cs

示例11: CacheItem

        public CacheItem(string key, object value, CacheItemPriority scavengingPriority,params ICacheItemExpiration[] expirations)
        {
            Initialize(key, value, scavengingPriority, expirations);

            TouchedByUserAction(false);
            InitializeExpirations();
        }
开发者ID:Tony-Liang,项目名称:Common,代码行数:7,代码来源:CacheItem.cs

示例12: CacheEntry

		internal CacheEntry (Cache objManager, string strKey, object objItem,CacheDependency objDependency,
				CacheItemRemovedCallback eventRemove, DateTime dtExpires, TimeSpan tsSpan,
				long longMinHits, bool boolPublic, CacheItemPriority enumPriority )
		{
			if (boolPublic)
				_enumFlags |= Flags.Public;

			_strKey = strKey;
			_objItem = objItem;
			_objCache = objManager;
			_onRemoved += eventRemove;
			_enumPriority = enumPriority;
			_ticksExpires = dtExpires.ToUniversalTime ().Ticks;
			_ticksSlidingExpiration = tsSpan.Ticks;

			// If we have a sliding expiration it overrides the absolute expiration (MS behavior)
			// This is because sliding expiration causes the absolute expiration to be 
			// moved after each period, and the absolute expiration is the value used 
			// for all expiration calculations.
			if (tsSpan.Ticks != Cache.NoSlidingExpiration.Ticks)
				_ticksExpires = DateTime.UtcNow.AddTicks (_ticksSlidingExpiration).Ticks;
			
			_objDependency = objDependency;
			if (_objDependency != null)
				// Add the entry to the cache dependency handler (we support multiple entries per handler)
				_objDependency.Changed += new CacheDependencyChangedHandler (OnChanged); 

			_longMinHits = longMinHits;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:29,代码来源:CacheEntry.cs

示例13: Insert

        public override void Insert(string cacheKey, object itemToCache, DNNCacheDependency dependency, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority,
                                   CacheItemRemovedCallback onRemoveCallback)
        {
            //onRemoveCallback += ItemRemovedCallback;

            //Call base class method to add obect to cache
            base.Insert(cacheKey, itemToCache, dependency, absoluteExpiration, slidingExpiration, priority, onRemoveCallback);
        }
开发者ID:robsiera,项目名称:OpenUrlRewriter,代码行数:8,代码来源:OpenUrlRewriterFBCachingProvider.cs

示例14: RedisCacheEntry

 public RedisCacheEntry(String key,
     Object value,
     DateTimeOffset absoluteExpiration,
     TimeSpan slidingExpiration,
     CacheItemPriority priority)
     : this(key, value, absoluteExpiration, slidingExpiration, priority.ToString())
 {
 }
开发者ID:cityindex,项目名称:Redis-Object-Cache,代码行数:8,代码来源:RedisCacheEntry.cs

示例15: CachedLifetime

        public static IExpressionRegistration CachedLifetime(this IExpressionRegistration registration, TimeSpan slidingExpiration, CacheDependency dependency = null, CacheItemPriority itemPriority = CacheItemPriority.Default, CacheItemRemovedCallback itemRemovedCallback = null)
        {
            if (registration == null)
                throw new ArgumentNullException("registration");

            registration.SetLifetime(new CachedLifetime(slidingExpiration, dependency, itemPriority, itemRemovedCallback));
            return registration;
        }
开发者ID:GeorgeR,项目名称:DynamoIOC,代码行数:8,代码来源:LifetimeExtensions.cs


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