Skip to content

Commit 8905491

Browse files
committed
chore: swap to in-memory cache
1 parent 9097d34 commit 8905491

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

packages/snap/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snap-solana-wallet.git"
88
},
99
"source": {
10-
"shasum": "PX/wKa2mYdwzedECTbqXOlecvAa0mjCDxP7KfPvisHg=",
10+
"shasum": "P6jwC0PbVHv426wnTqHF1mOKDr6qixo4G3H1o6kYzPk=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/snap/src/core/caching/InMemoryCache.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ export class InMemoryCache implements ICache<Serializable> {
9797
}
9898

9999
async keys(): Promise<string[]> {
100+
this.#cleanupExpiredEntries();
100101
return Array.from(this.#cache.keys());
101102
}
102103

103104
async size(): Promise<number> {
105+
this.#cleanupExpiredEntries();
104106
return this.#cache.size;
105107
}
106108

packages/snap/src/snapContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const assetsService = new AssetsService({
8282
configProvider,
8383
state,
8484
tokenMetadataService,
85-
cache: stateCache,
85+
cache: inMemoryCache,
8686
});
8787

8888
const transactionsService = new TransactionsService({

0 commit comments

Comments
 (0)