コード例 #1
0
        public static IServiceCollection AddStatisticsCenter(this IServiceCollection services,
                                                             Action <StatisticsBuilder> configure)
        {
            services.AddSingleton <IHostedService, StatisticsCenter>();

            var spiderStatisticsBuilder = new StatisticsBuilder(services);

            configure?.Invoke(spiderStatisticsBuilder);

            return(services);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public static StatisticsBuilder UseMemory(this StatisticsBuilder builder)
 {
     Check.NotNull(builder, nameof(builder));
     builder.Services.AddSingleton <IStatisticsStore, MemoryStatisticsStore>();
     return(builder);
 }