public static IServiceCollection AddStatisticsCenter(this IServiceCollection services, Action <StatisticsBuilder> configure) { services.AddSingleton <IHostedService, StatisticsCenter>(); var spiderStatisticsBuilder = new StatisticsBuilder(services); configure?.Invoke(spiderStatisticsBuilder); return(services); }
public static DotnetSpiderBuilder AddSpiderStatisticsCenter(this DotnetSpiderBuilder builder, Action <StatisticsBuilder> configure) { Check.NotNull(builder, nameof(builder)); builder.Services.AddSingleton <IStatisticsCenter, StatisticsCenter>(); var spiderStatisticsBuilder = new StatisticsBuilder(builder.Services); configure?.Invoke(spiderStatisticsBuilder); return(builder); }
public static StatisticsBuilder UseMemory(this StatisticsBuilder builder) { Check.NotNull(builder, nameof(builder)); builder.Services.AddSingleton <IStatisticsStore, MemoryStatisticsStore>(); return(builder); }