Skip to content

Home of flexible API to replace the default Next.js cache, accommodating custom cache solutions for multi-instance deployments.

License

Notifications You must be signed in to change notification settings

itzsrikanth/next-shared-cache

Repository files navigation

next-shared-cache

Developing

Install dependencies with:

npm ci

Start developing and watch for code handler and server changes:

npm run dev

In a new terminal run cache-testing app:

npm run build:app
npm run start:app

Remember that you need to rebuild cache-testing every time handler rebuild is happening.

Using Redis

Use Docker CLI with this command:

docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest

Create .env.local file inside apps/cache-testing directory and add environment variable:

REDIS_URL=redis://localhost:6379

Then run

npm run dev
npm run build:app
npm run start:app

Contributing

Run linting and formatting jobs before commit.

npm lint
npm format

Caveats

In-memory cache in dev mode

When you run npm dev the server is in watch mode. So it drops in-memory cache every time you save change in its sources.

Troubleshooting

If you are using VS Code and see Parsing error: Cannot find module 'next/babel' error in .js files create .vscode/settings.json config in the root of the project and add the following

{
    "eslint.workingDirectories": [{ "pattern": "apps/*/" }, { "pattern": "packages/*/" }, { "pattern": "utils/*/" }]
}

About

Home of flexible API to replace the default Next.js cache, accommodating custom cache solutions for multi-instance deployments.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 79.9%
  • JavaScript 17.3%
  • CSS 2.0%
  • Shell 0.8%