GithubHelp home page GithubHelp logo

cache-handler-redis-app's Introduction

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

cache-handler-redis-app's People

Contributors

katanabe avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.