An in-memory mock for basic Redis operations, currently at version 0.0.3. This package implements a subset of Redis functions purely in memory, intended for testing or development scenarios where a real Redis server is unavailable. It is an early-stage project with limited functionality, not suitable for production use. Alternatives like ioredis-mock or redis-mock provide more mature and feature-complete solutions. There is no active maintenance or release cadence.
npm install mock-redisNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage of mock-redis: create a client, set and get a key. Demonstrates both constructor and createClient methods, including callback and Promise patterns.
Use a more complete mock library like ioredis-mock for full Redis command coverage.
Check the source code or tests to ensure compatibility with your expected Redis client behavior. Consider using an alternative that matches your real client.
Switch to actively maintained alternatives such as ioredis-mock or redis-mock.
Use only for lightweight development or unit tests; never in production. For persistence, use real Redis or a mock with optional persistence.
Ensure you wait for the 'ready' event or use the callback in createClient. Example: const client = createClient(() => { /* ready */ });Use import { MockRedis } from 'mock-redis' and instantiate with new MockRedis(). Or use createClient().Use proper import: import { MockRedis } from 'mock-redis' in ESM, or const { MockRedis } = require('mock-redis') in CommonJS.No dependency data recorded yet.