Пример #1
0
        public static async Task SeedData()
        {
            var options = ConfigurationOptions.Parse(RedisSettings.ConnectionString);

            options.AllowAdmin = true;

            var connection = ConnectionMultiplexer.Connect(options);

            var leaderboardService = new LeaderboardService(connection);

            await connection.GetServer(RedisSettings.Server, RedisSettings.Port).FlushDatabaseAsync();

            await Task.WhenAll(
                leaderboardService.CreateTopic(1, "Topic #1", DateTime.UtcNow.AddHours(-24)),
                leaderboardService.CreateTopic(2, "Topic #2", DateTime.UtcNow.AddHours(-1)),
                leaderboardService.CreateTopic(3, "Topic #3", DateTime.UtcNow.AddHours(-12))
                );
        }
 public TopicsController(LeaderboardService service)
 {
     _service = service;
 }