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;
});

