mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
Cache info about users, cleanup for module
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using BotFramework;
|
||||
using Kruzya.TelegramBot.Core.Cache;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
@@ -7,6 +8,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core
|
||||
{
|
||||
@@ -36,6 +38,9 @@ namespace Kruzya.TelegramBot.Core
|
||||
services.AddDbContext<CoreContext>(ctx =>
|
||||
ctx.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)));
|
||||
|
||||
// Cache for users.
|
||||
services.AddSingleton<ICacheStorage<long, User>, MemoryCache<long, User>>();
|
||||
|
||||
// Trigger module handlers.
|
||||
_core.Modules.ConfigureServices(services);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user