
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
react-redis-cache
Advanced tools
A Redis-like cache for React with Redux integration, TTL, eviction policies, Pub/Sub, and async API caching
A Redis-like cache implementation for React with deep Redux integration, supporting TTL, eviction policies, data structures (Lists, Sets, Hashes), Pub/Sub, async API caching, persistence, and logging.
It works seamlessly across memory, localStorage, sessionStorage, and IndexedDB, making it a powerful choice for caching both UI state and API data in modern React applications.
| Feature | Description |
|---|---|
| TTL / Expiry | Set time-to-live for cached items. Expired items are auto-removed. |
| Eviction Policies | Supports LRU, LFU, and FIFO eviction when cache exceeds size limit. |
| Pause / Resume / Skip | Temporarily pause cache reads or skip next retrieval. |
| Pub/Sub | Subscribe to changes on cache keys or channels. |
| Data Structures | Lists, Sets, and Hashes, similar to Redis. |
| Async API Caching | getOrFetch automatically fetches & caches API results. |
| Redux Integration | Auto-cache Redux slices, update on specific actions. |
| Logging | Optional internal logging (enable/disable). |
| Persistence | Supports memory, localStorage, sessionStorage, and IndexedDB for reload persistence & large datasets. |
npm install react-redis-cache
import { ReactRedisCache } from "react-redis-cache";
import { store } from "./reduxStore";
const cache = new ReactRedisCache({
enableLogging: true,
evictionPolicy: "LRU",
mechanism: "indexedDB", // uses IndexedDB persistence
reduxConfig: {
store,
stateKey: "user",
actionsToWatch: ["UPDATE_USER", "LOGOUT"],
keyFn: (user) => `user:${user.id}`,
ttl: 60000 // 1 minute TTL
}
});
// Async get (IndexedDB returns Promise)
const cachedUser = await cache.get("user:123");
// Async API caching
const data = await cache.getOrFetch("posts", async () => {
const res = await fetch("/api/posts");
return await res.json();
}, 30000); // cache for 30s
// Pub/Sub
cache.subscribe("user:123", (updatedUser) =>
console.log("User updated", updatedUser)
);
lpush, rpush, lpop, rpop, lrangesadd, srem, smembershset, hget, hgetallreduxConfig: {
store, // Redux store instance
stateKey: "user", // Slice key in state
actionsToWatch: ["UPDATE_USER"], // List of actions to trigger cache update
keyFn: (slice) => `user:${slice.id}`, // Cache key generator
ttl: 60000 // TTL in ms
}
| Mechanism | Description |
|---|---|
| memory | In-memory cache. Cleared on reload. |
| localStorage | Browser localStorage persistence. |
| sessionStorage | Session-only persistence. |
| indexedDB | Large dataset persistence across reloads. |
get returns a Promise.enableLogging: true.FAQs
A Redis-like cache for React with Redux integration, TTL, eviction policies, Pub/Sub, and async API caching
We found that react-redis-cache 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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.