taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 234cebd7404c9c31f4d660aad9391231b37dd04a
parent 030b9f6f720f1bb42fef74fd15739499e9f1619a
Author: Florian Dold <florian@dold.me>
Date:   Wed, 10 Apr 2024 14:29:12 +0200

clear all caches when clearing DB

Diffstat:
Mpackages/taler-wallet-core/src/wallet.ts | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 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;