@neshca/cache-handler to your client components
- or pages. It is only meant to be used in cache-handler.mjs{' '}
- files.
- @neshca/cache-handler to your client components or pages. It is only meant to be used in cache-handler.mjs files.
3. **Integrate with Next.js**:
Update your `next.config.js` to utilize the cache handler, ensuring it's only active in production:
@@ -136,15 +132,13 @@ pnpm create next-app --example cache-handler-redis cache-handler-redis-app
}
```
- NEXT_RUNTIME environment variable to ensure that the
- instrumentation is only executed in Node.js. Use dynamic import to avoid
- bundling issues.
- NEXT_RUNTIME environment variable to ensure that the instrumentation is only executed in Node.js. Use dynamic import to avoid bundling issues.
This instrumentation will fill the cache with the initial data when the application starts. The duration of this process may vary based on the number and size of pages, routes, and fetch calls. For more information refer to the [Populating the Cache with the initial data](/usage/populating-cache-on-start) section.
-### Running Your Application
+## Running Your Application
**Start Your Next.js Application**:
@@ -155,7 +149,7 @@ npm run build
npm run start
```
-### Next Steps
+## Next Steps
With the setup complete, explore `@neshca/cache-handler`'s advanced features:
diff --git a/docs/cache-handler-docs/src/app/layout.tsx b/docs/cache-handler-docs/src/app/layout.tsx
new file mode 100644
index 00000000..86eb95e3
--- /dev/null
+++ b/docs/cache-handler-docs/src/app/layout.tsx
@@ -0,0 +1,62 @@
+import { Footer, Layout, Navbar } from 'nextra-theme-docs';
+import { Banner } from 'nextra/components';
+import { getPageMap } from 'nextra/page-map';
+import type { ReactNode } from 'react';
+import 'nextra-theme-docs/style.css';
+
+const banner = (
+ NEXT_RUNTIME environment variable to ensure that the
- instrumentation is only executed in Node.js. Use dynamic import to avoid
- bundling issues.
-NEXT_RUNTIME environment variable to ensure that the instrumentation is only executed in Node.js. Use dynamic import to avoid bundling issues.
This instrumentation will fill the cache with the initial data when the application starts. The duration of this process may vary based on the number and size of pages, routes, and fetch calls.
-### Using `output: 'standalone'` in `next.config.js`
+## Using `output: 'standalone'` in `next.config.js`
If you use the `output: 'standalone'` option in your `next.config.js` file, you must copy the `fetch-cache` directory to the `standalone` directory. Otherwise, the instrumentation will not pre-populate the cache with the initial fetch calls data.
@@ -53,7 +49,7 @@ Or using `Dockerfile`:
COPY .next/cache/fetch-cache/ .next/standalone/.next/cache/fetch-cache/
```
-#### Caveats
+## Caveats
When using the `output: 'standalone'` option in a monorepo, you may need to adjust the paths in the above command to match your project structure.
@@ -66,7 +62,7 @@ cp .next/cache/fetch-cache/* .next/standalone/@neshca/cache-handler, - project: { - link: 'https://github.com/caching-tools/next-shared-cache', - }, - docsRepositoryBase: - 'https://github.com/caching-tools/next-shared-cache/tree/canary/docs/cache-handler-docs', - head: Head, - footer: { - content: ( - - MIT {new Date().getFullYear()} ©{' '} - - @neshca/cache-handler - - . - - ), - }, - banner: { - key: 'version-1.9.0', - content: ( -