better cache
This commit is contained in:
22
site/scripts/cache-clear.ts
Normal file
22
site/scripts/cache-clear.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import "dotenv/config";
|
||||
|
||||
import { createCacheFromEnv } from "../src/lib/cache";
|
||||
|
||||
function log(msg: string) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`[cache-clear] ${msg}`);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const cache = await createCacheFromEnv(process.env, { namespace: "fast-website", log });
|
||||
await cache.flush();
|
||||
await cache.close();
|
||||
log("ok");
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(`[cache-clear] failed: ${String(e)}`);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user