本文整理汇总了C#中CacheEntry.UpdateLastModifiedTime方法的典型用法代码示例。如果您正苦于以下问题:C# CacheEntry.UpdateLastModifiedTime方法的具体用法?C# CacheEntry.UpdateLastModifiedTime怎么用?C# CacheEntry.UpdateLastModifiedTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CacheEntry
的用法示例。
在下文中一共展示了CacheEntry.UpdateLastModifiedTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertInternal
/// <summary>
/// Adds a pair of key and value to the cache. If the specified key already exists
/// in the cache; it is updated, otherwise a new item is added to the cache.
/// </summary>
/// <param name="key">key of the entry.</param>
/// <param name="cacheEntry">the cache entry.</param>
/// <returns>returns the result of operation.</returns>
internal override CacheInsResult InsertInternal(object key, CacheEntry cacheEntry, bool isUserOperation, CacheEntry oldEntry, OperationContext operationContext)
{
if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("LocalCache.Insert", "");
if (_cacheStore == null)
throw new InvalidOperationException();
if (cacheEntry.EvictionHint is PriorityEvictionHint)
cacheEntry.Priority = ((PriorityEvictionHint)cacheEntry.EvictionHint).Priority;
if (_evictionPolicy != null)
{
cacheEntry.EvictionHint = _evictionPolicy.CompatibleHint(cacheEntry.EvictionHint);
}
EvictionHint peEvh = oldEntry == null ? null : oldEntry.EvictionHint;
//+ [email protected]: No Need to insert Eviction if Eviction is turned off it will reduce cache-entry overhead
if (_evictionPolicy == null)
cacheEntry.EvictionHint = null;
//+ [email protected]
StoreInsResult result = _cacheStore.Insert(key, cacheEntry, !isUserOperation);
// Operation completed!
if (result == StoreInsResult.Success || result == StoreInsResult.SuccessNearEviction)
{
if (_evictionPolicy != null)
_evictionPolicy.Notify(key, null, cacheEntry.EvictionHint);
}
else if (result == StoreInsResult.SuccessOverwrite || result == StoreInsResult.SuccessOverwriteNearEviction)
{
//alam:
//update the cache item last modifeid time...
cacheEntry.UpdateLastModifiedTime(oldEntry);
if (_evictionPolicy != null)
_evictionPolicy.Notify(key, peEvh, cacheEntry.EvictionHint);
}
if (result == StoreInsResult.NotEnoughSpace && !_notifyCacheFull)
{
_notifyCacheFull = true;
_context.NCacheLog.Error("LocalCache.InsertInternal", "The cache is full and not enough items could be evicted.");
}
if (_context.PerfStatsColl != null)
{
if (_evictionPolicy != null)
_context.PerfStatsColl.SetEvictionIndexSize((long)_evictionPolicy.IndexInMemorySize);
if (_context.ExpiryMgr != null)
_context.PerfStatsColl.SetExpirationIndexSize((long)_context.ExpiryMgr.IndexInMemorySize);
}
switch (result)
{
case StoreInsResult.Success: return CacheInsResult.Success;
case StoreInsResult.SuccessOverwrite: return CacheInsResult.SuccessOverwrite;
case StoreInsResult.NotEnoughSpace: return CacheInsResult.NeedsEviction;
case StoreInsResult.SuccessNearEviction: return CacheInsResult.SuccessNearEvicition;
case StoreInsResult.SuccessOverwriteNearEviction: return CacheInsResult.SuccessOverwriteNearEviction;
}
return CacheInsResult.Failure;
}