Skip to content

Commit

Permalink
Introduce instant un-cache (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans authored Jun 16, 2022
1 parent 00f2701 commit d73b9c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/routes/protected/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { rm } from 'node:fs/promises';
import { join } from 'node:path';
import { generateSunflake } from 'sunflake';
import { Extract } from 'unzipper';
import { string } from 'yup';

import { StorageBackend } from '../..';
import { DB } from '../../database';
import { deleteCache } from '../../util/cache/cache';
import { useAPIToken } from '../../util/http/useAPIToken';
import { log } from '../../util/logging';
import { startAction } from '../../util/sentry/createChild';
Expand Down Expand Up @@ -200,6 +200,7 @@ export const CreateRoute: FastifyPluginAsync = async (router, options) => {
base_url: domain.domain,
deploy_id,
});
deleteCache('site_' + domain?.domain);
}
}
);
Expand Down
4 changes: 4 additions & 0 deletions src/util/cache/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ export const getCache = <T>(key: string) => {

return data.at(1) as T;
};

export const deleteCache = (key: string) => {
delete cache[key];
};

0 comments on commit d73b9c2

Please sign in to comment.