Registry / storage / thorin-store-redis

thorin-store-redis

JSON →
library2.1.0jsnpmunverified

Thorin-store-redis is the official Redis store adapter for the Thorin.js framework (v2.1.0). It provides session caching, background job queues, and pub/sub messaging integration. The package is maintained as part of the Thorin.js monorepo with monthly releases. Key differentiators include seamless integration with Thorin's async middleware and built-in connection pooling for high-throughput workloads.

npm install thorin-store-redis
INSTALL
IMPORT
SIG · THORIN-STORE-REDIS
T
thorin-store-redis
storagejavascriptv2.1.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.

thorin
import thorin from 'thorin'
const thorin = require('thorin')
Thorin.js is ESM-only since v2; CommonJS require will fail with ERR_REQUIRE_ESM
storeRedis
import { storeRedis } from 'thorin-store-redis'
import storeRedis from 'thorin-store-redis'
This package exports a named export, not a default export.
RedisStore
import { RedisStore } from 'thorin-store-redis'
TypeScript users prefer the class for type annotations; available as a named export.

Configures and uses the Redis store for session caching with async get/set operations.

import thorin from 'thorin'; import { storeRedis } from 'thorin-store-redis'; thorin.store('redis', { host: process.env.REDIS_HOST ?? 'localhost', port: parseInt(process.env.REDIS_PORT ?? '6379'), password: process.env.REDIS_PASSWORD ?? '' }); const store = thorin.store('redis'); await store.set('session:123', { userId: 456 }, { ttl: 3600 }); const data = await store.get('session:123'); console.log(data); // { userId: 456 }
Debug
Known issues
breakingv2.0 dropped support for Node.js < 16 and replaced redis package with ioredis
fix
Upgrade to Node.js 16+ and ensure your Redis commands are ioredis-compatible (e.g., no callbacks, use promises).
affects: >=2.0 <2.0
deprecatedThe old require('thorin-store-redis').default pattern is deprecated; use named import { storeRedis } instead.
fix
Change to import { storeRedis } from 'thorin-store-redis'.
affects: >=2.0
gotchastore.set() automatically serializes objects with JSON.stringify; retrieving with store.get() returns a plain object, not a class instance.
fix
Do not rely on prototype methods on retrieved objects; always treat as plain data.
affects: >=1.0
gotchaConnection errors are not retried by default; implement custom retry logic or use thorin's built-in store error handler.
fix
Add a retryStrategy in the config or listen to the 'error' event on the store instance.
affects: >=2.0
Errors
Common errors & fixes
Error: Cannot find module 'thorin-store-redis'
Package not installed or incorrect import path
fix
Run npm install thorin-store-redis and ensure import is { storeRedis } from 'thorin-store-redis'.
TypeError: store.get is not a function
The store was not initialized correctly (missing thorin.store call)
fix
Call thorin.store('redis', config) before attempting to use the store instance.
Redis connection refused (ECONNREFUSED)
Redis server not running or wrong host/port
fix
Start Redis server or check environment variables REDIS_HOST and REDIS_PORT.
Error: ReplyError: WRONGTYPE Operation against a key holding the wrong kind of value
Attempting to use a Redis command on a key of a different type (e.g., store.get on a list)
fix
Ensure the key was set with store.set (string type) and not via raw Redis commands.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies
thorinrequiredCore framework required for store lifecycle and dependency injection
ioredisrequiredRedis client library used under the hood for connection and commands
Agent activity
22 hits · last 30 days
node
20
Resources
thorin-store-redis — npm install thorin-store-redis · libregistry