38b3423160
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? Updating links to the @neshca/cache-handler documentation that are dead. ### Why? To improve developer experience (DX) by ensuring README.md links are functional. ### How? Edit the Markdown links in the README.md file of the example to point to the correct URLs. --> Hello, This PR updates dead links in the @neshca/cache-handler-redis example's README.md to ensure they point to the correct URLs. Thank you for your review! Co-authored-by: Jiwon Choi <devjiwonchoi@gmail.com> |
||
---|---|---|
.. | ||
app | ||
public | ||
.gitignore | ||
cache-handler.js | ||
docker-compose.yml | ||
next.config.js | ||
package.json | ||
README.md | ||
tsconfig.json |
Next.js Redis Cache Integration Example
This example is tailored for self-hosted setups and demonstrates how to use Redis as a shared cache. It is built on the principles of the @neshca/cache-handler
package, which replaces the default Next.js cache handler and adds advanced caching features.
Check out this repository that contains a comprehensive setup for Kubernetes.
How to use
Execute create-next-app
with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example cache-handler-redis cache-handler-redis-app
yarn create next-app --example cache-handler-redis cache-handler-redis-app
pnpm create next-app --example cache-handler-redis cache-handler-redis-app
Once you have installed the dependencies, you can begin running the example Redis Stack server by using the following command:
docker-compose up -d
Then, build and start the Next.js app as usual.
Documentation
For detailed information on configuration and usage, please refer to our comprehensive Documentation ↗.
Key Features and Considerations
-
Handlers: The
@neshca/cache-handler
package includes Handlers for seamless integration with Redis. -
Create Your Own Handlers: Take a look at Custom Redis Handler and use it as a basis to create your own handler.
-
Redis Server Setup: Ensure your Redis server is running and properly configured before starting your Next.js application.
-
Configure Redis Credentials: Update the
cache-handler-redis*
files with your Redis credentials. Connection details can be found here. -
Building Without Redis: To build the app without connecting to Redis use conditions inside
onCreation
callback. Check the documentation for more details.
Development and Production Considerations
-
The provided
docker-compose.yml
is intended for local development. For production deployment, refer to the official Redis installation and management guidelines. -
Clearing Redis Cache: To clear the Redis cache, use RedisInsight Workbench or the following CLI command:
docker exec -it redis-stack redis-cli 127.0.0.1:6379> flushall OK