nuxt-multi-cache
Version:
SSR route, component and data cache for Nuxt.js
21 lines (20 loc) • 466 B
JavaScript
import { defineEventHandler } from "h3";
import { useMultiCacheApp } from "../utils/useMultiCacheApp.js";
import { checkAuth } from "./helpers/index.js";
export default defineEventHandler(async (event) => {
await checkAuth(event);
const app = useMultiCacheApp();
if (!app.cache) {
return;
}
let key;
for (key in app.cache) {
const cache = app.cache[key];
if (cache) {
await cache.clear();
}
}
return {
status: "OK"
};
});