Registry / cache / think-cache-redis

think-cache-redis

JSON →
library1.2.6jsnpmunverified

Redis cache adapter for ThinkJS cache framework, version 1.2.6. Provides a Redis-backed caching solution specifically for ThinkJS applications, wrapping ioredis for Redis connectivity. Designed to be configured via ThinkJS adapter config, supporting common options like timeout. Limited to ThinkJS ecosystem; not a standalone Redis cache library.

npm install think-cache-redis
INSTALL
IMPORT
SIG · THINK-CACHE-REDIS
T
think-cache-redis
cachejavascriptv1.2.6
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.

default
const redisCache = require('think-cache-redis');
import redisCache from 'think-cache-redis';
Package has no ES module entry; only CommonJS is supported.
default
const redisCache = require('think-cache-redis');
import * as redisCache from 'think-cache-redis';
No named exports; default export only.
default
const redisCache = require('think-cache-redis');
const { redisCache } = require('think-cache-redis');
Export is a function, not an object with a property.

Configures think-cache-redis in a ThinkJS adapter file with Redis connection settings.

// In src/config/adapter.js const redisCache = require('think-cache-redis'); exports.cache = { type: 'redis', common: { timeout: 24 * 3600 * 1000 // millisecond }, redis: { handle: redisCache, port: 6379, host: process.env.REDIS_HOST ?? '127.0.0.1', password: process.env.REDIS_PASSWORD ?? '' } };
Debug
Known issues
gotchaPackage is tightly coupled to ThinkJS framework; does not work as a standalone cache client.
fix
Use only within a ThinkJS project.
affects: >=0.1.0
deprecatedThinkJS 2.x support has been dropped; use version 1.x with ThinkJS 3.x.
fix
Update ThinkJS to 3.x.
affects: 1.0.0 - 1.2.6
gotchaOnly CJS require supported; ESM import will fail.
fix
Use require() instead of import.
affects: >=1.0.0
breakingVersion 1.0.0 changed the export from a class to a function; existing code using 'new' may break.
fix
Use as a function handle, not a constructor.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'think-cache-redis'
Package not installed or not in node_modules.
fix
Run npm install think-cache-redis --save (or yarn add think-cache-redis).
TypeError: thinkCache is not a constructor
Trying to instantiate the exported function with 'new' after version 1.0.0.
fix
Pass the module reference as a 'handle' option, not as a constructor.
SyntaxError: Unexpected token import
Using ES module import syntax with a CommonJS-only package.
fix
Replace import with require().
Upgrade
Version history
1.2.6latest on npm
Audit
Dependencies
ioredisrequiredRedis client library used for all Redis operations.
Agent activity
33 hits · last 30 days
node
30
OpenAI (training)
1
Resources
think-cache-redis — npm install think-cache-redis · libregistry