Overview
The @neshca/cache-handler npm package is designed to provide a specialized ISR/Data cache API tailored for Next.js applications. By simplifying the configuration of shared cache strategies in distributed environments, such as setups with multiple independent application instances, this library offers an easy-to-integrate solution. It aims to streamline custom cache strategies, particularly for uses with Redis.
Features
- Shared Cache for Distributed Environments: Ideal for self-hosted deployments with multiple application instances.
- Easy Customization: Provides a simple API with pre-configured Handlers for customization.
- On-Demand Revalidation: Simplifies revalidation across all application replicas.
- TTL Management: Automated cache cleanup for efficient storage space management.
- Support for Next.js Routers: Comprehensive support and a single setup for Pages and the App Router.
- neshCache Function: Allows the use of the neshCache function for enhanced control over caching.
Installation
To install the @neshca/cache-handler npm package, follow these steps:
npm install @neshca/cache-handler
Include the package in your Next.js application using:
import neshCache from '@neshca/cache-handler';
Summary
The @neshca/cache-handler npm package facilitates the implementation of cache strategies in complex distributed environments by offering features like shared cache support, easy customization, and on-demand revalidation. With comprehensive documentation and examples, it provides a robust solution for optimizing caching in Next.js applications.