public FormController(IMediator mediator, IMapper mapper, IOptions <ApplicationCacheOptions> cacheOptions, ITokenService tokenService) { _cacheOptions = cacheOptions.Value; _mediator = mediator; _mapper = mapper; _tokenService = tokenService; }
// migrated private void ConfigureCache(IServiceCollection services) { var cacheOptions = new ApplicationCacheOptions(); Configuration.GetSection(nameof(ApplicationCacheOptions)).Bind(cacheOptions); switch (cacheOptions.Implementation) { case "NoCache": { _container.RegisterInstance <ICacheService>(new NoCacheService()); break; } case "RedisCache": { _container.RegisterSingleton <ICacheService, CacheService>(); services.AddDistributedRedisCache(options => { Configuration.GetSection("RedisCacheOptions").Bind(options); }); break; } case "MemoryDistributedCache": { _container.RegisterSingleton <ICacheService, CacheService>(); services.AddDistributedMemoryCache(); break; } } }
public static IServiceCollection AddCachingService(this IServiceCollection services, IConfiguration configuration) { var cacheOptions = new ApplicationCacheOptions(); configuration.GetSection(nameof(ApplicationCacheOptions)).Bind(cacheOptions); switch (cacheOptions.Implementation) { case "NoCache": { services.AddSingleton <ICacheService, NoCacheService>(); break; } case "RedisCache": { services.AddSingleton <ICacheService, CacheService>(); services.AddDistributedRedisCache(options => { configuration.GetSection("RedisCacheOptions").Bind(options); }); break; } case "MemoryDistributedCache": { services.AddSingleton <ICacheService, CacheService>(); services.AddDistributedMemoryCache(); break; } } return(services); }
public StatisticsController(IMediator mediator, IConfiguration configuration, IOptions <ApplicationCacheOptions> cacheOptions) { _mediator = mediator; _configuration = configuration; _cacheOptions = cacheOptions.Value; }
public FormController(IMediator mediator, IOptions <ApplicationCacheOptions> cacheOptions) { _cacheOptions = cacheOptions.Value; _mediator = mediator; }