Registry / database / kv-redis

kv-redis

JSON →
library0.1.3jsnpmunverified

Redis storage backend for the 'kv' key-value store library. Version 0.1.3 is the current stable release. This package provides a simple integration for using Redis as the persistent layer for kv. It wraps redis operations and exposes them through the kv abstraction, enabling easy swapping of storage backends. Differentiators: minimal overhead, direct use of node_redis client, and compatibility with kv's API.

npm install kv-redis
INSTALL
IMPORT
SIG · KV-REDIS
K
kv-redis
databasejavascriptv0.1.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RedisKV
import { RedisKV } from 'kv-redis'
const RedisKV = require('kv-redis');
Package is ESM-only for Node >= 12. Use dynamic import if needed in CommonJS.
default
import RedisKV from 'kv-redis'
import { default as RedisKV } from 'kv-redis'
Default export available for convenience.
RedisKVOptions
import type { RedisKVOptions } from 'kv-redis'
TypeScript type available for options object.

Shows how to create a RedisKV instance, connect it to a KV store, perform basic put/get/delete operations.

import { RedisKV } from 'kv-redis'; import { KV } from 'kv'; // Create RedisKV instance (defaults to localhost:6379) const redisKV = new RedisKV({ url: process.env.REDIS_URL ?? 'redis://localhost:6379', prefix: 'myapp:' }); // Connect and use as KV store const kv = new KV(redisKV); await kv.put('key', 'value'); const val = await kv.get('key'); console.log(val); // 'value' await kv.delete('key'); await kv.close();
Debug
Known issues
gotchaDefault export may not exist in some versions; check import syntax.
fix
Use named import { RedisKV } from 'kv-redis'.
affects: <=0.1.0
gotchaPackage does not handle reconnection automatically; connection failures may cause errors.
fix
Implement retry logic or use a wrapper around the connection.
affects: >=0
gotchaRedis client must be connected before calling any methods; ensure ready event before operations.
fix
Connect explicitly via the init method or wait for the 'ready' event if using client directly.
affects: >=0
Errors
Common errors & fixes
Cannot find module 'kv-redis'
Package not installed or incorrectly imported.
fix
Run npm install kv-redis, then ensure correct import path.
TypeError: RedisKV is not a constructor
Using default import when only named export exists (or vice versa).
fix
Use import { RedisKV } from 'kv-redis'.
Error: Redis connection refused
Redis server not running or connection URI is wrong.
fix
Check REDIS_URL env var or default host:port, start Redis server.
Upgrade
Version history
0.1.3latest on npm
Audit
Dependencies
kvrequiredCore key-value store library that this package extends with Redis backend
Agent activity
7 hits · last 30 days
node
7
Resources
kv-redis — npm install kv-redis · libregistry