diff --git a/PluralKit.Core/ProxyCache.cs b/PluralKit.Core/ProxyCache.cs index 3b9a6fd8..c410efba 100644 --- a/PluralKit.Core/ProxyCache.cs +++ b/PluralKit.Core/ProxyCache.cs @@ -27,14 +27,19 @@ namespace PluralKit.Core public Task InvalidateSystem(PKSystem system) => InvalidateSystem(system.Id); + public void InvalidateAccounts(IEnumerable accounts) + { + foreach (var account in accounts) + _cache.Remove(KeyForAccount(account)); + } + public void InvalidateDeletedSystem(int systemId, IEnumerable accounts) { // Used when the system's already removed so we can't look up accounts // We assume the account list is saved already somewhere and can be passed here (which is the case in Store) _cache.Remove(KeyForSystem(systemId)); - foreach (var account in accounts) - _cache.Remove(KeyForAccount(account)); + InvalidateAccounts(accounts); } public async Task InvalidateSystem(int systemId) diff --git a/PluralKit.Core/Stores.cs b/PluralKit.Core/Stores.cs index 721a584c..cbbda0c9 100644 --- a/PluralKit.Core/Stores.cs +++ b/PluralKit.Core/Stores.cs @@ -509,6 +509,7 @@ namespace PluralKit { _logger.Information("Unlinked system {System} from account {Account}", system.Id, accountId); await _cache.InvalidateSystem(system); + _cache.InvalidateAccounts(new [] { accountId }); } public async Task GetSystemByAccount(ulong accountId) {