Typereaders finished, cleanup

This commit is contained in:
Master Kwoth
2017-10-10 00:04:02 +02:00
parent 3d3871f903
commit 0bacb1f780
19 changed files with 436 additions and 274 deletions

View File

@ -5,19 +5,20 @@ namespace NadekoBot.Services.Impl
{
public class RedisCache : IDataCache
{
private ulong _botid;
public ConnectionMultiplexer Redis { get; }
private readonly IDatabase _db;
public RedisCache(ulong botId)
public RedisCache()
{
_botid = botId;
Redis = ConnectionMultiplexer.Connect("127.0.0.1");
Redis.PreserveAsyncOrder = false;
_db = Redis.GetDatabase();
}
// things here so far don't need the bot id
// because it's a good thing if different bots
// which are hosted on the same PC
// can re-use the same image/anime data
public async Task<(bool Success, byte[] Data)> TryGetImageDataAsync(string key)
{
byte[] x = await _db.StringGetAsync("image_" + key);