Skip to content

Commit d73b9c2

Browse files
authored
Introduce instant un-cache (#54)
1 parent 00f2701 commit d73b9c2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/routes/protected/create.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { rm } from 'node:fs/promises';
55
import { join } from 'node:path';
66
import { generateSunflake } from 'sunflake';
77
import { Extract } from 'unzipper';
8-
import { string } from 'yup';
98

109
import { StorageBackend } from '../..';
1110
import { DB } from '../../database';
11+
import { deleteCache } from '../../util/cache/cache';
1212
import { useAPIToken } from '../../util/http/useAPIToken';
1313
import { log } from '../../util/logging';
1414
import { startAction } from '../../util/sentry/createChild';
@@ -200,6 +200,7 @@ export const CreateRoute: FastifyPluginAsync = async (router, options) => {
200200
base_url: domain.domain,
201201
deploy_id,
202202
});
203+
deleteCache('site_' + domain?.domain);
203204
}
204205
}
205206
);

src/util/cache/cache.ts

+4
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ export const getCache = <T>(key: string) => {
1515

1616
return data.at(1) as T;
1717
};
18+
19+
export const deleteCache = (key: string) => {
20+
delete cache[key];
21+
};

0 commit comments

Comments
 (0)