From 75b390cf93e0903b1859f02a3f3508bc16a4565a Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 10 Nov 2017 12:22:19 -0500 Subject: Add functions to clear stores cache --- src/stores/balance_proxy_allowance_lazy_store.ts | 10 ++++++++++ src/stores/order_filled_cancelled_lazy_store.ts | 6 ++++++ 2 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/stores/balance_proxy_allowance_lazy_store.ts b/src/stores/balance_proxy_allowance_lazy_store.ts index 2580fd449..92a6aaa51 100644 --- a/src/stores/balance_proxy_allowance_lazy_store.ts +++ b/src/stores/balance_proxy_allowance_lazy_store.ts @@ -42,6 +42,11 @@ export class BalanceAndProxyAllowanceLazyStore { } this.balance[tokenAddress][userAddress] = balance; } + public deleteBalance(tokenAddress: string, userAddress: string): void { + if (!_.isUndefined(this.balance[tokenAddress])) { + delete this.balance[tokenAddress][userAddress]; + } + } public async getProxyAllowanceAsync(tokenAddress: string, userAddress: string): Promise { if (_.isUndefined(this.proxyAllowance[tokenAddress]) || _.isUndefined(this.proxyAllowance[tokenAddress][userAddress])) { @@ -60,4 +65,9 @@ export class BalanceAndProxyAllowanceLazyStore { } this.proxyAllowance[tokenAddress][userAddress] = proxyAllowance; } + public deleteProxyAllowance(tokenAddress: string, userAddress: string): void { + if (!_.isUndefined(this.proxyAllowance[tokenAddress])) { + delete this.proxyAllowance[tokenAddress][userAddress]; + } + } } diff --git a/src/stores/order_filled_cancelled_lazy_store.ts b/src/stores/order_filled_cancelled_lazy_store.ts index beb8fe6d7..cb4c786f3 100644 --- a/src/stores/order_filled_cancelled_lazy_store.ts +++ b/src/stores/order_filled_cancelled_lazy_store.ts @@ -35,6 +35,9 @@ export class OrderFilledCancelledLazyStore { public setFilledTakerAmount(orderHash: string, filledTakerAmount: BigNumber): void { this.filledTakerAmount[orderHash] = filledTakerAmount; } + public deleteFilledTakerAmount(orderHash: string): void { + delete this.filledTakerAmount[orderHash]; + } public async getCancelledTakerAmountAsync(orderHash: string): Promise { if (_.isUndefined(this.cancelledTakerAmount[orderHash])) { const methodOpts = { @@ -49,4 +52,7 @@ export class OrderFilledCancelledLazyStore { public setCancelledTakerAmount(orderHash: string, cancelledTakerAmount: BigNumber): void { this.cancelledTakerAmount[orderHash] = cancelledTakerAmount; } + public deleteCancelledTakerAmount(orderHash: string): void { + delete this.cancelledTakerAmount[orderHash]; + } } -- cgit v1.2.3