blob: 19f0f548d84f0e5215b6bbe5258e480c9212ed1e [file]
using System;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.DependencyInjection;
namespace Apache.Geode.Session
{
public static class GeodeCacheServiceCollectionExtensions
{
public static IServiceCollection AddGeodeSessionStateCache(this IServiceCollection services, Action<GeodeSessionStateCacheOptions> setupAction)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
if (setupAction == null)
{
throw new ArgumentNullException(nameof(setupAction));
}
services.AddOptions();
services.Add(ServiceDescriptor.Singleton<IDistributedCache, GeodeSessionStateCache>());
services.Configure(setupAction);
return services;
}
}
}