src/DotNetCommon.Core/Cache/MemoryCacheEntryExtensions.cs
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
//using Microsoft.Extensions.Primitives;
//using System;
//using System.Collections.Generic;
//using System.Text;
//
//namespace DotNetCommon.Cache
//{
// internal static class MemoryCacheEntryExtensions
// {
// /// <summary>
// /// Sets the priority for keeping the cache entry in the cache during a memory pressure tokened cleanup.
// /// </summary>
// /// <param name="options">The option on which to set the priority.</param>
// /// <param name="priority">The <see cref="CacheItemPriority"/> to set on the option.</param>
// /// <returns>The <see cref="MemoryCacheEntryOptions"/> so that additional calls can be chained.</returns>
// public static MemoryCacheEntryOptions SetPriority(
// this MemoryCacheEntryOptions options,
// CacheItemPriority priority)
// {
// options.Priority = priority;
// return options;
// }
//
// /// <summary>
// /// Sets the size of the cache entry value.
// /// </summary>
// /// <param name="options">The options to set the entry size on.</param>
// /// <param name="size">The size to set on the <see cref="MemoryCacheEntryOptions"/>.</param>
// /// <returns>The <see cref="MemoryCacheEntryOptions"/> so that additional calls can be chained.</returns>
// public static MemoryCacheEntryOptions SetSize(
// this MemoryCacheEntryOptions options,
// long size)
// {
// if (size < 0)
// {
// throw new ArgumentOutOfRangeException(nameof(size), size, $"{nameof(size)} must be non-negative.");
// }
//
// options.Size = size;
// return options;
// }
//
// /// <summary>
// /// Expire the cache entry if the given <see cref="IChangeToken"/> expires.
// /// </summary>
// /// <param name="options">The <see cref="MemoryCacheEntryOptions"/>.</param>
// /// <param name="expirationToken">The <see cref="IChangeToken"/> that causes the cache entry to expire.</param>
// /// <returns>The <see cref="MemoryCacheEntryOptions"/> so that additional calls can be chained.</returns>
// public static MemoryCacheEntryOptions AddExpirationToken(
// this MemoryCacheEntryOptions options,
// IChangeToken expirationToken)
// {
// if (expirationToken == null)
// {
// throw new ArgumentNullException(nameof(expirationToken));
// }
//
// options.ExpirationTokens.Add(expirationToken);
// return options;
// }
后面还有 88 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
