Skip to content

Commit 9c98129

Browse files
committed
Actually include the documentation in the nuget package
Add missing documentation
1 parent 8a62497 commit 9c98129

File tree

9 files changed

+61
-1
lines changed

9 files changed

+61
-1
lines changed

AsyncMemoryCache/AsyncMemoryCache.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace AsyncMemoryCache;
1313

1414
/// <summary>
1515
/// This interface exists mainly to avoid having concrete types as constructor arguments.
16-
/// An effect of this is enabling subsitution and as a result, easier testing, where an actual concrete instance is not required in each and every test that uses a class that looks like the following
16+
/// An effect of this is enabling substitution and as a result, easier testing, where an actual concrete instance is not required in each and every test that uses a class that looks like the following
1717
/// <para/>
1818
/// <code>
1919
/// public MyService(AsyncMemoryCache&lt;string, SomeCacheable&gt;) { }
@@ -71,6 +71,11 @@ public sealed class AsyncMemoryCache<TKey, TValue> : IAsyncDisposable, IAsyncMem
7171
private readonly IDictionary<TKey, CacheEntity<TKey, TValue>> _cache;
7272
private readonly ILogger<AsyncMemoryCache<TKey, TValue>> _logger;
7373

74+
/// <summary>
75+
/// Creates a new instance of <see cref="AsyncMemoryCache{TKey, TValue}"/> with the supplied arguments.
76+
/// </summary>
77+
/// <param name="configuration">The <see cref="IAsyncMemoryCacheConfiguration{TKey, TValue}"/>.</param>
78+
/// <param name="logger">The optional <see cref="ILogger{CategoryName}">ILogger</see>&lt;<see cref="AsyncMemoryCache{TKey, TValue}"></see>&gt;</param>
7479
public AsyncMemoryCache(IAsyncMemoryCacheConfiguration<TKey, TValue> configuration, ILogger<AsyncMemoryCache<TKey, TValue>>? logger = null)
7580
{
7681
#if NET8_0_OR_GREATER
@@ -146,6 +151,7 @@ public bool TryGetValue(TKey key, [NotNullWhen(true)] out CacheEntityReference<T
146151
return false;
147152
}
148153

154+
/// <inheritdoc/>
149155
public async ValueTask DisposeAsync()
150156
{
151157
await _configuration.EvictionBehavior.DisposeAsync().ConfigureAwait(false);

AsyncMemoryCache/AsyncMemoryCache.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<EnableNETAnalyzers>true</EnableNETAnalyzers>
1010
<AnalysisLevel>preview</AnalysisLevel>
1111

12+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1213
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1314
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
1415
</PropertyGroup>

AsyncMemoryCache/AsyncMemoryCacheConfiguration.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public interface IAsyncMemoryCacheConfiguration<TKey, TValue>
1616
where TKey : notnull
1717
where TValue : IAsyncDisposable
1818
{
19+
/// <summary>
20+
/// The callback to be invoked when a cache item expires.
21+
/// </summary>
1922
Action<TKey, TValue>? CacheItemExpired { get; init; }
2023

2124
/// <summary>
@@ -38,6 +41,7 @@ public sealed class AsyncMemoryCacheConfiguration<TKey, TValue> : IAsyncMemoryCa
3841
where TKey : notnull
3942
where TValue : IAsyncDisposable
4043
{
44+
/// <inheritdoc/>
4145
public Action<TKey, TValue>? CacheItemExpired { get; init; }
4246

4347
/// <inheritdoc/>

AsyncMemoryCache/CacheEntity.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,26 @@ public sealed class CacheEntity<TKey, TValue>
1414
where TKey : notnull
1515
where TValue : IAsyncDisposable
1616
{
17+
/// <summary>
18+
/// Creates a new instance of <see cref="CacheEntity{TKey, TValue}"/> with the supplied arguments.
19+
/// </summary>
20+
/// <param name="key">The <typeparamref name="TKey"/>.</param>
21+
/// <param name="objectFactory">The <see cref="Func{TResult}">Func</see>&lt;<see cref="Task{TValue}"></see>&gt;.</param>
22+
/// <param name="lazyFlags">The <see cref="AsyncLazyFlags"/>.</param>
1723
public CacheEntity(TKey key, Func<Task<TValue>> objectFactory, AsyncLazyFlags lazyFlags)
1824
{
1925
Key = key;
2026
ObjectFactory = new(objectFactory, lazyFlags);
2127
}
2228

29+
/// <summary>
30+
/// The <typeparamref name="TKey"/>.
31+
/// </summary>
2332
public TKey Key { get; }
33+
34+
/// <summary>
35+
/// The <see cref="AsyncLazy{T}">AsyncLazy</see>&lt;<typeparamref name="TValue"/>&gt; which represents the cache item creation method.
36+
/// </summary>
2437
public AsyncLazy<TValue> ObjectFactory { get; }
2538

2639
private int _references;

AsyncMemoryCache/CacheEntityReference.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@ public sealed class CacheEntityReference<TKey, TValue> : IDisposable
1717
{
1818
private bool _disposed;
1919

20+
/// <summary>
21+
/// The <see cref="CacheEntity{TKey, TValue}"/> which this object wraps.
22+
/// </summary>
2023
public CacheEntity<TKey, TValue> CacheEntity { get; }
2124

25+
/// <summary>
26+
/// Creates a new instance of <see cref="CacheEntityReference{TKey, TValue}"/> with the supplied arguments.
27+
/// </summary>
28+
/// <param name="cacheEntity">The <see cref="CacheEntity{TKey, TValue}"/> to wrap.</param>
2229
public CacheEntityReference(CacheEntity<TKey, TValue> cacheEntity)
2330
{
2431
#if NET8_0_OR_GREATER
@@ -32,6 +39,10 @@ public CacheEntityReference(CacheEntity<TKey, TValue> cacheEntity)
3239
_ = Interlocked.Increment(ref cacheEntity.References);
3340
}
3441

42+
/// <summary>
43+
/// The finalizer for <see cref="CacheEntityReference{TKey, TValue}"/>.
44+
/// This serves as a fail-safe if <see cref="Dispose"/> is never called.
45+
/// </summary>
3546
#if NET8_0_OR_GREATER
3647
[ExcludeFromCodeCoverage(Justification = "Finalizers are unreliable in tests")]
3748
#endif
@@ -40,6 +51,7 @@ public CacheEntityReference(CacheEntity<TKey, TValue> cacheEntity)
4051
Dispose();
4152
}
4253

54+
/// <inheritdoc/>
4355
public void Dispose()
4456
{
4557
if (_disposed)

AsyncMemoryCache/EvictionBehaviors/DefaultEvictionBehavior.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public sealed class DefaultEvictionBehavior : IEvictionBehavior
2020
private readonly PeriodicTimer _timer;
2121
private Task? _workerTask;
2222

23+
/// <summary>
24+
/// Creates a new instance of <see cref="DefaultEvictionBehavior"/> with the supplied arguments.
25+
/// </summary>
26+
/// <param name="timeProvider">The <see cref="TimeProvider"/>.</param>
27+
/// <param name="evictionCheckInterval">The interval to use when checking for expired items.</param>
2328
public DefaultEvictionBehavior(TimeProvider? timeProvider = default, TimeSpan? evictionCheckInterval = default)
2429
{
2530
_interval = evictionCheckInterval ?? TimeSpan.FromSeconds(30);
@@ -29,13 +34,18 @@ public DefaultEvictionBehavior(TimeProvider? timeProvider = default, TimeSpan? e
2934
#else
3035
private Timer? _timer;
3136

37+
/// <summary>
38+
/// Creates a new instance of <see cref="DefaultEvictionBehavior"/> with the supplied arguments.
39+
/// </summary>
40+
/// <param name="evictionCheckInterval">The interval to use when checking for expired items.</param>
3241
public DefaultEvictionBehavior(TimeSpan? evictionCheckInterval = default)
3342
{
3443
_cts = new();
3544
_interval = evictionCheckInterval ?? TimeSpan.FromSeconds(30);
3645
}
3746
#endif
3847

48+
/// <inheritdoc/>
3949
public void Start<TKey, TValue>(IAsyncMemoryCacheConfiguration<TKey, TValue> configuration, ILogger<AsyncMemoryCache<TKey, TValue>> logger)
4050
where TKey : notnull
4151
where TValue : IAsyncDisposable
@@ -106,6 +116,7 @@ private static async Task CheckExpiredItems<TKey, TValue>(IAsyncMemoryCacheConfi
106116
logger.LogTrace("Done checking expired items. Evicted {EvictedItemsCount} items.", expiredItems.Count);
107117
}
108118

119+
/// <inheritdoc/>
109120
#if NET8_0_OR_GREATER
110121
public async ValueTask DisposeAsync()
111122
{

AsyncMemoryCache/EvictionBehaviors/EvictionBehavior.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace AsyncMemoryCache.EvictionBehaviors;
55

6+
/// <summary>
7+
/// A class containing default values for implementations of <see cref="IEvictionBehavior"/>
8+
/// </summary>
69
public static class EvictionBehavior
710
{
811
/// <inheritdoc cref="DefaultEvictionBehavior"/>
@@ -15,6 +18,10 @@ public static class EvictionBehavior
1518
public static readonly IEvictionBehavior Disabled = new NoOpEvictionBehavior();
1619
}
1720

21+
/// <summary>
22+
/// An interface that can be used to implement custom eviction behaviors.
23+
/// See <see cref="EvictionBehavior"/> for default implementations.
24+
/// </summary>
1825
public interface IEvictionBehavior : IAsyncDisposable
1926
{
2027
/// <summary>

AsyncMemoryCache/Extensions/CacheEntityReferenceExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace AsyncMemoryCache.Extensions;
55

6+
/// <summary>
7+
/// A class containing extension methods to ease the configuration of a <see cref="CacheEntity{TKey, TValue}"/> object.
8+
/// </summary>
69
public static class CacheEntityReferenceExtensions
710
{
811
/// <summary>

AsyncMemoryCache/Extensions/ServiceCollectionExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace AsyncMemoryCache.Extensions;
55

6+
/// <summary>
7+
/// A class containing extension methods to help with configuration of an <see cref="IServiceCollection"/>.
8+
/// </summary>
69
public static class ServiceCollectionExtensions
710
{
811
/// <summary>

0 commit comments

Comments
 (0)