Rework caching

This does a *lot* of things. Essentially, it replaces the existing
individual proxy- and autoproxy caches on the bot end with a
global cache (in Core) that handles all the caching at once, and
automatically invalidates the cache once something changes in the
datastore.

This allows us to do proxying and autoproxying with *zero database
queries* (best-case).
This commit is contained in:
Ske
2020-02-01 14:40:57 +01:00
parent 125ea81ec3
commit 82dfe43d5a
16 changed files with 254 additions and 255 deletions

View File

@@ -8,12 +8,10 @@ namespace PluralKit.Bot.Commands
public class MemberProxy
{
private IDataStore _data;
private ProxyCacheService _proxyCache;
public MemberProxy(IDataStore data, ProxyCacheService proxyCache)
public MemberProxy(IDataStore data)
{
_data = data;
_proxyCache = proxyCache;
}
public async Task Proxy(Context ctx, PKMember target)
@@ -117,9 +115,6 @@ namespace PluralKit.Bot.Commands
await _data.SaveMember(target);
await ctx.Reply($"{Emojis.Success} Member proxy tags set to `{requestedTag.ProxyString.SanitizeMentions()}`.");
}
await _proxyCache.InvalidateResultsForSystem(ctx.System);
}
}
}