Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a self-hosted shared cache example #58000

Merged
merged 4 commits into from
Nov 9, 2023

Conversation

better-salmon
Copy link
Contributor

@better-salmon better-salmon commented Nov 3, 2023

What?

This pull request integrates the exemplary setup for a self-hosted Next.js application utilizing Redis as a shared cache storage. The solution supports caching at both the App and Pages routers in default and standalone modes, as well as partial pre-rendering, facilitated by the @neshca/cache-handler package. The package enables customizing cache handlers and replacing the default cache provided by Next.js seamlessly.

Why?

The motivation behind this pull request is to provide an example demonstrating how Redis can be used as a shared cache in a self-hosted environment, thereby improving the scalability of hosting multiple instances of a Next.js application.

@better-salmon better-salmon requested review from a team as code owners November 3, 2023 17:17
@better-salmon better-salmon requested review from ismaelrumzan and lydiahallie and removed request for a team November 3, 2023 17:17
@ijjk ijjk added the examples Issue/PR related to examples label Nov 3, 2023
@Fredkiss3
Copy link
Contributor

You may want to wait for this #57953 before merging and update your PR when it has been merged

@better-salmon
Copy link
Contributor Author

You may want to wait for this #57953 before merging and update your PR when it has been merged

Hi @Fredkiss3, thank you for pointing out PR #57953. I had it in mind and should have mentioned it earlier. It's reasonable to wait for this feature, especially if it will be included in the upcoming 14.1.0 release by the Next.js team. I'll keep an eye on that PR, and once it's merged, I'll update my PR accordingly.

Copy link
Member

@leerob leerob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making this!

@leerob
Copy link
Member

leerob commented Nov 8, 2023

Went ahead and merged the improved self-hosting docs before this. Do you want to link back to the example in the updated docs in this PR?

@better-salmon
Copy link
Contributor Author

Went ahead and merged the improved self-hosting docs before this. Do you want to link back to the example in the updated docs in this PR?

@leerob, do you mean I can add a link or/and some description for this example to the updated docs by myself?

@leerob
Copy link
Member

leerob commented Nov 8, 2023

Yeah, I'm suggesting in this PR, maybe add a sentence to link back to this example in the "Deploying" documentation also inside of this repo.

- Rename the example to `cache-handler-redis` to make naming consistent with docs and future next.config.js option name.
- Reorder the information in the docs to make it easier to follow.
- Add the `cache-handler-redis` example to the docs.
- Remove the misleading `cache` class field from the docs example.
@better-salmon
Copy link
Contributor Author

@leerob, please review the modifications I made in the documentation.

@ijjk
Copy link
Member

ijjk commented Nov 9, 2023

Allow CI Workflow Run

  • approve CI run for commit: 4e523bc

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@ijjk
Copy link
Member

ijjk commented Nov 9, 2023

Allow CI Workflow Run

  • approve CI run for commit: 4e523bc

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Copy link
Member

@leerob leerob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Thank you for this contribution!

@kodiakhq kodiakhq bot merged commit e2f3059 into vercel:canary Nov 9, 2023
55 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2023
@better-salmon better-salmon deleted the self-hosted-shared-cache branch August 15, 2024 19:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants