Skip to content

Commit eba31a7

Browse files
authored
Merge pull request #1635 from merico-dev/fix-cache
fix(cache): ensure content-specific cache directories are created
2 parents fc1dfe3 + 6abd042 commit eba31a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

api/src/utils/fs_cache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ export const clearFsCacheByContentId = (contentId: string) => {
3131
};
3232

3333
export const putFsCache = async (contentId: string, key: string, data: any): Promise<void> => {
34-
fs.ensureDirSync(cacheDir);
34+
fs.ensureDirSync(path.join(cacheDir, contentId));
3535
const filename = `${key}.json`;
3636
await fs.writeJSON(path.join(cacheDir, contentId, filename), data);
3737
};
3838

3939
export const getFsCache = async (contentId: string, key: string): Promise<any> => {
40-
fs.ensureDirSync(cacheDir);
40+
fs.ensureDirSync(path.join(cacheDir, contentId));
4141
const ttl = await getTTL();
4242
const filename = `${key}.json`;
4343
try {

0 commit comments

Comments
 (0)