Registry / database / coa-redis

coa-redis

JSON →
library1.7.0jsnpmunverified

coa-redis (v1.7.0) is a lightweight Redis component for the coajs framework on Node.js, written in TypeScript and built on top of ioredis. It provides functional components including a key-value data cache, a lightweight message queue with worker pattern, cron-based timing tasks, and distributed locks. All operations require a namespace parameter for data isolation. The library is small (hundreds of lines) with no third-party dependencies beyond ioredis. Release cadence is low, with the last update likely from 2021.

npm install coa-redis
INSTALL
IMPORT
SIG · COA-REDIS
C
coa-redis
databasejavascriptv1.7.0
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.

RedisBin
import { RedisBin } from 'coa-redis'
const RedisBin = require('coa-redis').RedisBin
ESM import is preferred. CJS require also works if using Node.js with CommonJS.
RedisCache
import { RedisCache } from 'coa-redis'
import RedisCache from 'coa-redis'
RedisCache is a named export, not default.
RedisQueue
import { RedisQueue } from 'coa-redis'
import { Queue } from 'coa-redis'
The component is named RedisQueue; check the docs for exact exports.

Creates a RedisBin configuration instance and a RedisCache, then sets and gets cache data with a namespace.

import { RedisBin, RedisCache } from 'coa-redis'; const redisConfig = { host: process.env.REDIS_HOST ?? '127.0.0.1', port: parseInt(process.env.REDIS_PORT ?? '6379'), password: process.env.REDIS_PASSWORD ?? '', db: 0, prefix: 'test_', trace: false, }; const redisBin = new RedisBin(redisConfig); const redisCache = new RedisCache(redisBin); async function main() { await redisCache.set('mymodule', 'key1', 'value1', 60000); const val = await redisCache.get('mymodule', 'key1'); console.log(val); // 'value1' } main().catch(console.error);
Debug
Known issues
gotchaAll cache operations require a namespace parameter (nsp). Omitting it leads to runtime errors.
fix
Always pass a string as the first argument to set/get/delete methods (e.g., redisCache.set('module1', 'mykey', value)).
affects: >=1.0.0
gotchaThe prefix option in RedisBin config is not automatically applied to all keys; it must be handled manually if needed.
fix
Check the library source or manually prefix keys if global prefix is required.
affects: >=1.0.0
deprecatedThe 'trace' option is undocumented and may not work as expected.
fix
Avoid using 'trace'; rely on ioredis's built-in monitoring.
affects: >=1.0.0
gotchaRedisQueue and RedisCron require careful lifecycle management to avoid memory leaks.
fix
Call close/destroy methods on the components when no longer needed.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'coa-redis'
Package not installed or not in node_modules.
fix
Run 'npm install coa-redis' or 'yarn add coa-redis'.
RedisBin is not a constructor
Import error: likely using wrong import syntax or module system mismatch.
fix
Use correct import: import { RedisBin } from 'coa-redis' (ESM) or const { RedisBin } = require('coa-redis') (CJS).
TypeError: redisCache.get is not a function
Namespace parameter omitted in method call.
fix
Ensure you pass a namespace string as the first argument: redisCache.get('mynamespace', 'myid').
Upgrade
Version history
1.7.0latest on npm
Audit
Dependencies
ioredisrequiredcore Redis client dependency; used for all Redis operations
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
coa-redis — npm install coa-redis · libregistry