Repository for implementing caching solutions in Next.js. This monorepo contains cache handlers and utilities designed to provide efficient, scalable caching for Next.js applications.
@nimpl/cache-redis Redis-based cache handler with multi-pod support. Implements a two-tier caching strategy: an in-memory LRU cache for fast local access and Redis for shared cache across multiple pods. This architecture enables efficient cache sharing in Kubernetes deployments where multiple instances need to share cached data.
Read more about @nimpl/cache-redis
npm install @nimpl/cache-redis
# or
pnpm add @nimpl/cache-redisConfigure the cache handler in your next.config.ts:
import { type NextConfig } from "next/types";
const nextConfig: NextConfig = {
cacheComponents: true,
cacheHandlers: {
default: import.meta.resolve("@nimpl/cache-redis"),
},
};
export default nextConfig;Set the Redis connection URL:
REDIS_URL=redis://localhost:6379@nimpl/cache-widget is a React widget for visualizing and inspecting cache entries from @nimpl/cache-redis. It provides a user-friendly interface to view cache keys, their details, and metadata in your application.
Read more about @nimpl/cache-widget
@nimpl/cache-tools provides utilities for working with @nimpl/cache-like cache handlers, including data retrieval and function caching. It offers helpers for creating cached functions and API routes for cache inspection tools like @nimpl/cache-widget.
Read more about @nimpl/cache-tools
Note: The following packages are outdated and not actively maintained for now. They will be updated and improved soon:
@nimpl/cache-adapter- Legacy cache adapter package@nimpl/cache-in-memory- Legacy in-memory cache handlerFor new projects, use
@nimpl/cache-redisinstead.