
Research
/Security News
Mini Shai-Hulud Campaign Hits Red Hat Cloud Services npm Packages
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.
@nimpl/cache-redis
Advanced tools
Redis-based cache handler. Designed for Next.js but can be used to build custom caching solutions for any other stack
Redis-based cache handler with multi-pod support. Designed for Next.js but can be used to build custom caching solutions for any other stack (e.g. cache function in React Router 7 or Remix).
@nimpl/cache-redis is a showcase library that demonstrates how to build a cache handler using @nimpl/cache. It implements a two-tier caching strategy: an in-memory LRU cache for fast local access and Redis for shared cache across multiple pods.
Note: This is a showcase library. In most cases, you should build your own cache-handler using
@nimpl/cacheto have full control over configuration and layers.For detailed information on handlers, layers, custom implementations, and advanced configuration, see the
@nimpl/cacheREADME.
The cache handler uses a layered approach:
On cache miss in-memory, the handler fetches from Redis and populates the local LRU cache.
npm install @nimpl/cache-redis
# or
pnpm add @nimpl/cache-redis
Configure the cache handler in 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;
The cache handler accepts the following parameters (all optional):
logger (Logger): Custom logging function. Default: console logger (enabled when NEXT_PRIVATE_DEBUG_CACHE or NIC_LOGGER is set)lruOptions (LRUCache.Options): Options for the LRU cache instance
maxSize: Maximum cache size in bytes. Default: 50 * 1024 * 1024 (50MB) or LRU_CACHE_MAX_SIZE env var (in MB)ttl (number | "auto"): Time-to-live in seconds. Default: "auto"redisOptions (RedisOptions): Redis connection options from ioredis
url: Redis connection URL. Default: process.env.REDIS_URL || "redis://localhost:6379"connectionStrategy ("ignore" | "wait-ignore" | "wait-throw" | "wait-exit"): Connection failure behavior. Default: "ignore"You can initialize the cache handler with custom configuration:
// cache-handlers/redis.js
import { CacheHandler } from "@nimpl/cache-redis/cache-handler";
global.cacheHandler ||= new CacheHandler({
lruOptions: { maxSize: 100 * 1024 * 1024 },
redisOptions: { connectionStrategy: "wait-ignore" },
});
// next.config.ts
import { type NextConfig } from "next/types";
const nextConfig: NextConfig = {
cacheComponents: true,
cacheHandlers: {
default: import.meta.resolve("./cache-handlers/redis.js"),
},
};
export default nextConfig;
Note: It is recommended to write to
global, as otherwise the instance will be created differently for Next.js and for your independent use (for example, for cache-widget or your internal utilities). As a result, in-memory entries will be different, and will also be duplicated.
Use Next.js cache APIs as usual:
import { cacheLife } from "next/cache";
export default async function Page() {
"use cache";
cacheLife({ stale: 30, revalidate: 60, expire: 120 });
// Your component logic
}
The cache handler can be used directly with @nimpl/cache-tools:
import { CacheHandler } from "@nimpl/cache-redis/cache-handler";
import { createCache } from "@nimpl/cache-tools";
const cacheHandler = new CacheHandler({
redisOptions: { keyPrefix: "admin:" },
});
export const { cache } = createCache(cacheHandler);
For detailed information on:
See the @nimpl/cache README.
FAQs
Redis-based cache handler. Designed for Next.js but can be used to build custom caching solutions for any other stack
The npm package @nimpl/cache-redis receives a total of 54 weekly downloads. As such, @nimpl/cache-redis popularity was classified as not popular.
We found that @nimpl/cache-redis demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.

Research
/Security News
The North Korean malware loader hides in a Packagist-listed package and its GitHub branch to fetch and execute remote code in a likely Contagious Interview-style lure.

Security News
The Rust project is moving toward formal rules on LLM use in contributions after months of internal debate over maintainer burden, code quality, and contributor experience.