diff options
author | Florian Dold <florian@dold.me> | 2024-04-10 14:29:12 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-04-10 14:29:12 +0200 |
commit | 234cebd7404c9c31f4d660aad9391231b37dd04a (patch) | |
tree | ec67845d5f123d262557920743cf21735e27911c | |
parent | 030b9f6f720f1bb42fef74fd15739499e9f1619a (diff) | |
download | wallet-core-234cebd7404c9c31f4d660aad9391231b37dd04a.tar.gz wallet-core-234cebd7404c9c31f4d660aad9391231b37dd04a.tar.bz2 wallet-core-234cebd7404c9c31f4d660aad9391231b37dd04a.zip |
clear all caches when clearing DB
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index d8361c6e4..2666e6eb7 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -1208,9 +1208,11 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>( case WalletApiOperation.TestCrypto: { return await wex.cryptoApi.hashString({ str: "hello world" }); } - case WalletApiOperation.ClearDb: + case WalletApiOperation.ClearDb: { + wex.ws.clearAllCaches(); await clearDatabase(wex.db.idbHandle()); return {}; + } case WalletApiOperation.Recycle: { throw Error("not implemented"); return {}; @@ -1757,6 +1759,12 @@ export class InternalWalletState { clientCancellationMap: Map<string, CancellationToken.Source> = new Map(); + clearAllCaches(): void { + this.exchangeCache.clear(); + this.denomInfoCache.clear(); + this.refreshCostCache.clear(); + } + initWithConfig(newConfig: WalletRunConfig): void { this._config = newConfig; |