From 09ca4bc1f497dcf7e0de79e1acbcf985b9868d58 Mon Sep 17 00:00:00 2001 From: corsacca Date: Thu, 23 Apr 2026 20:00:07 +0100 Subject: [PATCH] change caching from fs to memory. --- nuxt.config.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index 76702793..190f784b 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -89,12 +89,17 @@ export default defineNuxtConfig({ devStorage: { cache: { driver: 'memory' } }, - // Production: persist the `cache` mount to disk so defineCachedEventHandler - // entries survive process restarts and redeploys. Purges (see - // server/utils/cmsCache.ts) remain fast; disk I/O here is a single fs - // write per cache entry. `.cache/` is gitignored. + // Production: in-process memory driver. Railway runs a single + // container and doesn't guarantee `./.cache/` persistence in a way + // Nitro's fs driver can rely on — it behaves like a serverless fs + // (writes succeed locally but reads silently miss), making + // defineCachedEventHandler a no-op in prod. Memory is the simplest + // correct driver for single-replica hosts: cache lives for the life + // of the process, gets cleared on deploy (fine — content re-warms + // on first visit). Swap to a shared driver (e.g. Redis on Railway) + // if the service ever scales to >1 replica. storage: { - cache: { driver: 'fs', base: './.cache' } + cache: { driver: 'memory' } }, prerender: { // CMS pages (catch-all [...slug]) are rendered live per request so