2022-03-29 05:03:01 +00:00
|
|
|
|
using RegexBot.Data;
|
2019-02-16 00:49:54 +00:00
|
|
|
|
|
2022-03-29 05:03:01 +00:00
|
|
|
|
namespace RegexBot.Services.EntityCache;
|
|
|
|
|
/// <summary>
|
2022-07-21 01:55:08 +00:00
|
|
|
|
/// Provides and maintains a database-backed cache of entities.
|
2022-03-29 05:03:01 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
class EntityCacheService : Service {
|
|
|
|
|
private readonly UserCachingSubservice _uc;
|
2022-08-17 23:59:30 +00:00
|
|
|
|
#pragma warning disable IDE0052
|
2022-05-12 03:26:28 +00:00
|
|
|
|
private readonly MessageCachingSubservice _mc;
|
2022-08-17 23:59:30 +00:00
|
|
|
|
#pragma warning restore IDE0052
|
2019-02-16 00:49:54 +00:00
|
|
|
|
|
2022-03-29 05:03:01 +00:00
|
|
|
|
internal EntityCacheService(RegexbotClient bot) : base(bot) {
|
2022-07-28 05:00:10 +00:00
|
|
|
|
_uc = new UserCachingSubservice(bot, Log);
|
2022-08-17 23:59:30 +00:00
|
|
|
|
_mc = new MessageCachingSubservice(bot);
|
2018-12-05 20:47:25 +00:00
|
|
|
|
}
|
2022-03-29 05:03:01 +00:00
|
|
|
|
|
|
|
|
|
// Hooked
|
2022-05-12 03:26:28 +00:00
|
|
|
|
internal CachedUser? QueryUserCache(string search)
|
|
|
|
|
=> _uc.DoUserQuery(search);
|
|
|
|
|
|
|
|
|
|
// Hooked
|
|
|
|
|
internal CachedGuildUser? QueryGuildUserCache(ulong guildId, string search)
|
|
|
|
|
=> _uc.DoGuildUserQuery(guildId, search);
|
2018-12-05 20:47:25 +00:00
|
|
|
|
}
|