Skip to content

Commit bab3648

Browse files
committed
chore: use mdelete
1 parent 8905491 commit bab3648

2 files changed

Lines changed: 6 additions & 6 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": "P6jwC0PbVHv426wnTqHF1mOKDr6qixo4G3H1o6kYzPk=",
10+
"shasum": "GV3a2RYqpu9UtZC2Jp8ppDd3PfxJbPEwiuawJC5INs0=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ export class InMemoryCache implements ICache<Serializable> {
4242
return cacheEntry.expiresAt < Date.now();
4343
}
4444

45-
#cleanupExpiredEntries(): void {
45+
async #cleanupExpiredEntries(): Promise<void> {
4646
const expiredKeys: string[] = [];
4747
for (const [key, entry] of this.#cache.entries()) {
4848
if (this.#isExpired(entry)) {
4949
expiredKeys.push(key);
5050
}
5151
}
52-
expiredKeys.forEach((key) => this.#cache.delete(key));
52+
await this.mdelete(expiredKeys);
5353
}
5454

5555
async get(key: string): Promise<Serializable | undefined> {
@@ -97,12 +97,12 @@ export class InMemoryCache implements ICache<Serializable> {
9797
}
9898

9999
async keys(): Promise<string[]> {
100-
this.#cleanupExpiredEntries();
100+
await this.#cleanupExpiredEntries();
101101
return Array.from(this.#cache.keys());
102102
}
103103

104104
async size(): Promise<number> {
105-
this.#cleanupExpiredEntries();
105+
await this.#cleanupExpiredEntries();
106106
return this.#cache.size;
107107
}
108108

@@ -118,7 +118,7 @@ export class InMemoryCache implements ICache<Serializable> {
118118
async mget(
119119
keys: string[],
120120
): Promise<Record<string, Serializable | undefined>> {
121-
this.#cleanupExpiredEntries();
121+
await this.#cleanupExpiredEntries();
122122

123123
const result: Record<string, Serializable | undefined> = {};
124124
const expiredKeys: string[] = [];

0 commit comments

Comments
 (0)