Skip to content

Commit 88ce049

Browse files
MirzaMerdovicalastairtree
authored andcommitted
Add xml comments to IAppCache, CachingService and DI extension methods
1 parent d56113e commit 88ce049

File tree

5 files changed

+448
-114
lines changed

5 files changed

+448
-114
lines changed

LazyCache.AspNetCore/LazyCacheServiceCollectionExtensions.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,21 @@
77
// ReSharper disable once CheckNamespace - MS guidelines say put DI registration in this NS
88
namespace Microsoft.Extensions.DependencyInjection
99
{
10-
// See https://github.com/dotnet/runtime/blob/master/src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCacheServiceCollectionExtensions.cs
10+
// See https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCacheServiceCollectionExtensions.cs
11+
/// <summary>
12+
/// Set of extensions for registering LazyCache dependencies with <see cref="IServiceCollection"/> instance.
13+
/// </summary>
1114
public static class LazyCacheServiceCollectionExtensions
1215
{
16+
/// <summary>
17+
/// Register a non distributed in memory implementation of <see cref="IAppCache"/>.
18+
/// </summary>
19+
/// <remarks>
20+
/// For implementation details see <see cref="CachingService"/>
21+
/// </remarks>
22+
/// <param name="services">Instance of <see cref="IServiceCollection"/>.</param>
23+
/// <returns>Modified instance of <see cref="IServiceCollection"/>.</returns>
24+
/// <exception cref="ArgumentNullException"></exception>
1325
public static IServiceCollection AddLazyCache(this IServiceCollection services)
1426
{
1527
if (services == null) throw new ArgumentNullException(nameof(services));
@@ -25,6 +37,13 @@ public static IServiceCollection AddLazyCache(this IServiceCollection services)
2537
return services;
2638
}
2739

40+
/// <summary>
41+
/// Register a custom implementation of <see cref="IAppCache"/> to the
42+
/// </summary>
43+
/// <param name="services">Instance of <see cref="IServiceCollection"/>.</param>
44+
/// <param name="implementationFactory">A delegate that allows users to inject their own <see cref="IAppCache"/> implementation.</param>
45+
/// <returns>Modified instance of <see cref="IServiceCollection"/.></returns>
46+
/// <exception cref="ArgumentNullException">Thrown when any of: <paramref name="services"/> or <paramref name="implementationFactory"/> are null.</exception>
2847
public static IServiceCollection AddLazyCache(this IServiceCollection services,
2948
Func<IServiceProvider, CachingService> implementationFactory)
3049
{

LazyCache.Ninject/LazyCacheModule.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,36 @@
66

77
namespace LazyCache
88
{
9+
// See https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCacheServiceCollectionExtensions.cs
10+
/// <summary>
11+
/// Set of extensions for registering LazyCache dependencies with <see cref="IServiceCollection"/> instance.
12+
/// </summary>
913
public class LazyCacheModule : NinjectModule
1014
{
1115
private readonly Func<IAppCache> implementationFactory;
1216

17+
/// <summary>
18+
/// Initializes new instance of <see cref="LazyCacheModule"/>.
19+
/// </summary>
20+
/// <remarks>
21+
/// For implementation details see <see cref="CachingService"/>
22+
/// </remarks>
1323
public LazyCacheModule()
1424
{
1525
}
1626

27+
/// <summary>
28+
/// Initializes new instance of <see cref="LazyCacheModule"/>.
29+
/// </summary>
30+
/// <param name="implementationFactory">A delegate that allows users to inject their own <see cref="IAppCache"/> implementation.</param>
1731
public LazyCacheModule(Func<IAppCache> implementationFactory)
1832
{
1933
this.implementationFactory = implementationFactory;
2034
}
2135

22-
// See also https://github.com/aspnet/Caching/blob/dev/src/Microsoft.Extensions.Caching.Memory/MemoryCacheServiceCollectionExtensions.cs
36+
/// <summary>
37+
/// Overrides <see cref="NinjectModule.Load"/> and registers LazyeCache dependencies.
38+
/// </summary>
2339
public override void Load()
2440
{
2541
Bind<IOptions<MemoryCacheOptions>>().ToConstant(Options.Create(new MemoryCacheOptions()));

0 commit comments

Comments
 (0)