src/DotNetCommon.Core/Cache/Impl/MemoryCache.cs
(开头部分) 19KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
//using DotNetCommon.Cache.Internal;
//using DotNetCommon.Logger;
//using System;
//using System.Collections.Concurrent;
//using System.Collections.Generic;
//using System.Runtime.CompilerServices;
//using System.Text;
//using System.Threading;
//using System.Threading.Tasks;
//
//namespace DotNetCommon.Cache.Impl
//{
// /// <summary>
// /// An implementation of <see cref="IMemoryCache"/> using a dictionary to
// /// store its entries.
// /// </summary>
// internal class MemoryCache : IMemoryCache
// {
// internal readonly ILogger _logger;
//
// private readonly MemoryCacheOptions _options;
// internal readonly ConcurrentDictionary<object, CacheEntry> _entries;
//
// private long _cacheSize;
// private bool _disposed;
// private DateTimeOffset _lastExpirationScan;
//
// /// <summary>
// /// Creates a new <see cref="MemoryCache"/> instance.
// /// </summary>
// public MemoryCache(MemoryCacheOptions options)
// {
// if (options == null)
// {
// throw new ArgumentNullException(nameof(options));
// }
//
// _options = options;
// _logger = LoggerFactory.CreateLogger<MemoryCache>();
//
// _entries = new ConcurrentDictionary<object, CacheEntry>();
//
// if (_options.Clock == null)
// {
// _options.Clock = new SystemClock();
// }
//
// _lastExpirationScan = _options.Clock.UtcNow;
// }
//
// /// <summary>
// /// Cleans up the background collection events.
// /// </summary>
// ~MemoryCache() => Dispose(false);
//
// /// <summary>
// /// Gets the count of the current entries for diagnostic purposes.
// /// </summary>
// public int Count => _entries.Count;
//
后面还有 462 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
