
Security News
Frontier AI Is Now Critical Infrastructure
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.
@sebspark/memredis
Advanced tools
An in-memory implementation of Redis. Fully compatible with the Redis client API for development, testing, and scenarios where an in-memory store suffices.
@sebspark/memredisAn in-memory implementation of Redis. Fully compatible with the Redis client API for development, testing, and scenarios where an in-memory store suffices.
yarn add @sebspark/memredis
import { MemRedis } from '@sebspark/memredis'
const client = new MemRedis()
// Set and get
await client.set('key', 'value')
const value = await client.get('key') // 'value'
// Expiration
await client.setEx('temp-key', 60, 'expires in 60 seconds')
const ttl = await client.ttl('temp-key') // ~60
// Delete
await client.del('key')
const client = new MemRedis()
await client.hSet('user:1', { name: 'Alice', age: '30' })
const user = await client.hGetAll('user:1') // { name: 'Alice', age: '30' }
await client.hDel('user:1', 'age')
const client = new MemRedis()
// Lists
await client.lPush('queue', ['job1', 'job2'])
const job = await client.lPop('queue') // 'job2'
// Sets
await client.sAdd('tags', ['a', 'b', 'c'])
const members = await client.sMembers('tags') // ['a', 'b', 'c']
// Sorted sets
await client.zAdd('leaderboard', { score: 100, value: 'alice' })
const top = await client.zRangeWithScores('leaderboard', 0, 0, { REV: true })
All MemRedis instances share the same pub/sub bus, matching real Redis behaviour where all clients connect to the same server.
If you type against IPersistor, pub/sub subscription methods use transport-specific return values. MemRedis returns subscription counts, while redis clients resolve those methods without a value.
import { MemRedis } from '@sebspark/memredis'
const publisher = new MemRedis()
const subscriber = new MemRedis()
await subscriber.subscribe('events', (message) => {
console.log('Received:', message)
})
await publisher.publish('events', 'hello world')
Use MemRedis in tests to avoid Docker overhead while still maintaining Redis-compatible behavior. The e2e test suite verifies MemRedis behavior matches actual Redis exactly.
import { describe, it, expect } from 'vitest'
import { MemRedis } from '@sebspark/memredis'
describe('my cache', () => {
it('stores and retrieves values', async () => {
const cache = new MemRedis()
await cache.set('key', 'value')
expect(await cache.get('key')).toBe('value')
})
})
For production use cases requiring Redis features, use the official redis package.
FAQs
An in-memory implementation of Redis. Fully compatible with the Redis client API for development, testing, and scenarios where an in-memory store suffices.
We found that @sebspark/memredis demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.