You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
551 B
22 lines
551 B
import { createCache } from "cache";
|
|
|
|
const cache = createCache({
|
|
// redis: {
|
|
// host: process.env.REDIS_HOST ?? '127.0.0.1',
|
|
// port: Number(process.env.REDIS_PORT ?? 6379),
|
|
// password: process.env.REDIS_PASSWORD,
|
|
// db: Number(process.env.REDIS_DB ?? 0),
|
|
// },
|
|
// defaultTtl: 300,
|
|
memory: true,
|
|
});
|
|
|
|
if (import.meta.dev) {
|
|
console.log("plugin: 00.cache");
|
|
}
|
|
|
|
export default defineNitroPlugin((nitroApp) => {
|
|
nitroApp.hooks.hook("request", (event) => {
|
|
event.context.cache = cache;
|
|
});
|
|
});
|