本文整理汇总了C#中CacheItem.HasExpired方法的典型用法代码示例。如果您正苦于以下问题:C# CacheItem.HasExpired方法的具体用法?C# CacheItem.HasExpired怎么用?C# CacheItem.HasExpired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CacheItem
的用法示例。
在下文中一共展示了CacheItem.HasExpired方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItemIsNotExpiredIfNoExpirationsAreGiven
public void ItemIsNotExpiredIfNoExpirationsAreGiven()
{
CacheItem cacheItem = new CacheItem("key", "value", CacheItemPriority.Normal, null);
Assert.IsFalse(cacheItem.HasExpired(),
"Cache objects with no expirations are never expired");
}
示例2: ItemIsNotExpiredIfEmptyExpirationArrayIsGiven
public void ItemIsNotExpiredIfEmptyExpirationArrayIsGiven()
{
CacheItem cacheItem = new CacheItem("key", "value", CacheItemPriority.Normal, null, new ICacheItemExpiration[0]);
Assert.IsFalse(cacheItem.HasExpired(),
"Cache object with no expirations are never expired");
}
示例3: ItemIsExpiredIfAnyExpirationsAreTrue
public void ItemIsExpiredIfAnyExpirationsAreTrue()
{
CacheItem cacheItem = new CacheItem("key", "value", CacheItemPriority.Normal, null, new NeverExpired(), new AlwaysExpired());
Assert.IsTrue(cacheItem.HasExpired(),
"Any expirations in collection are expired, cache object is expired");
}
示例4: CanExpireCacheItemFromSingleExpirationObject
public void CanExpireCacheItemFromSingleExpirationObject()
{
CacheItem cacheItem = new CacheItem("key", "value", CacheItemPriority.Normal, null, new AlwaysExpired());
Assert.IsTrue(cacheItem.HasExpired(),
"Item should be considered expired if its expiration object is expired");
}
示例5: ItemShouldNotBeExpiredIfNoExpirationObjectIsExpired
public void ItemShouldNotBeExpiredIfNoExpirationObjectIsExpired()
{
CacheItem cacheItem = new CacheItem("key", "value", CacheItemPriority.Normal, null, new NeverExpired());
Assert.IsFalse(cacheItem.HasExpired(),
"No expiration object is expired, cache object should not be expired");
}
示例6: ItemNotExpiredIfAllExpirationsAreFalse
public void ItemNotExpiredIfAllExpirationsAreFalse()
{
CacheItem cacheItem = new CacheItem("key", "value", CacheItemPriority.Normal, null, new NeverExpired(), new NeverExpired());
Assert.IsFalse(cacheItem.HasExpired(),
"No expiration in collection is expired, cache object should not be expired");
}