Skip to content

Commit

Permalink
fix: parallelize set higher priority at wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
zzau13 committed Nov 2, 2022
1 parent 7726393 commit 7f76e54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/multi-caching.ts
Expand Up @@ -39,9 +39,9 @@ export function multiCaching<Caches extends Cache[]>(
await set<T>(key, result, ttl);
return result;
} else {
for (let j = 0; j < i; j++) {
await caches[j].set(key, value, ttl);
}
await Promise.all(
caches.slice(0, i).map((cache) => cache.set(key, value, ttl)),
);
}
return value;
},
Expand Down

0 comments on commit 7f76e54

Please sign in to comment.