2019-02-16 00:49:54 +00:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2018-12-05 20:47:25 +00:00
|
|
|
|
namespace Kerobot.Services.EntityCache
|
|
|
|
|
{
|
2019-02-16 00:49:54 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides and maintains a database-backed cache of entities. Portions of information collected by this
|
|
|
|
|
/// service may be used by modules, while other portions are useful only for external applications which may
|
|
|
|
|
/// require this information, such as an external web interface.
|
|
|
|
|
/// </summary>
|
|
|
|
|
class EntityCacheService : Service
|
2018-12-05 20:47:25 +00:00
|
|
|
|
{
|
2019-02-16 00:49:54 +00:00
|
|
|
|
private readonly UserCache _uc;
|
|
|
|
|
|
|
|
|
|
internal EntityCacheService(Kerobot kb) : base(kb)
|
2018-12-05 20:47:25 +00:00
|
|
|
|
{
|
2019-02-16 00:49:54 +00:00
|
|
|
|
// Currently we only have UserCache. May add Channel and Server caches later.
|
|
|
|
|
_uc = new UserCache(kb);
|
2018-12-05 20:47:25 +00:00
|
|
|
|
}
|
2019-02-16 00:49:54 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2019-03-17 00:07:57 +00:00
|
|
|
|
/// See <see cref="Kerobot.EcQueryUser(ulong, string)"/>.
|
2019-02-16 00:49:54 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
internal Task<CachedUser> QueryUserCache(ulong guildId, string search) => _uc.Query(guildId, search);
|
2018-12-05 20:47:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|