Registry / database / cachified-redis-json-adapter

cachified-redis-json-adapter

JSON →
library2.0.0jsnpmunverified

A caching adapter for @epic-web/cachified that supports redis-json (RedisJSON module). Version 2.0.0 is the current stable release, actively maintained by a single contributor. It provides a drop-in replacement for the built-in Redis adapter when you need to store cached JSON documents natively in Redis using the RedisJSON module, enabling partial updates and nested field retrieval. Ships TypeScript definitions.

npm install cachified-redis-json-adapter
INSTALL
IMPORT
SIG · CACHIFIED-REDIS-JS
C
cachified-redis-json-adapter
databasejavascriptv2.0.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.

redisJsonCacheAdapter
✓ import { redisJsonCacheAdapter } from 'cachified-redis-json-adapter'
✗ const redisJsonCacheAdapter = require('cachified-redis-json-adapter')
ESM-only since v2.0.0; CommonJS require() will fail.
RedisJsonCacheAdapter
✓ import { RedisJsonCacheAdapter } from 'cachified-redis-json-adapter'
✗ import RedisJsonCacheAdapter from 'cachified-redis-json-adapter'
Named export, not default export. The type is also exported.
createRedisJsonCache
✓ import { createRedisJsonCache } from 'cachified-redis-json-adapter'
✗ import { createRedisJsonCache } from 'cachified-redis-json-adapter/dist'
Available since v1.1.0; deprecated in v2.0.0 (alias for redisJsonCacheAdapter). Prefer redisJsonCacheAdapter.

Creates a RedisJSON cache adapter and uses it with cachified to cache a JSON object.

import {redisJsonCacheAdapter} from 'cachified-redis-json-adapter'; import {createClient} from 'redis'; import {cachified} from '@epic-web/cachified'; const redisClient = createClient(); await redisClient.connect(); const redisCache = redisJsonCacheAdapter(redisClient); const result = await cachified({ key: 'my-key', cache: redisCache, getFreshValue: async () => ({hello: 'world'}), ttl: 60_000, }); console.log(result); await redisClient.quit();
Debug
Known issues
breakingNamed change from createRedisJsonCache to redisJsonCacheAdapter in v2.0.0
fix
Use redisJsonCacheAdapter instead of createRedisJsonCache.
affects: >=2.0.0
breakingESM-only package – CommonJS require() will throw ERR_REQUIRE_ESM
fix
Switch to ESM imports in your project, or use dynamic import() in CJS.
affects: >=2.0.0
deprecatedcreateRedisJsonCache is deprecated since v2.0.0 and will be removed in a future version
fix
Replace createRedisJsonCache with redisJsonCacheAdapter.
affects: <2.0.0
gotchaThe adapter expects a redis-json client created with createClient() and JSON module loaded on the Redis server
fix
Ensure the Redis server has the RedisJSON module installed and the client is connected before passing it.
affects: *
Errors
Common errors & fixes
TypeError: redisJsonCacheAdapter is not a function
Importing the package with CommonJS require() after v2.0.0, which is ESM-only.
fix
Use import { redisJsonCacheAdapter } from 'cachified-redis-json-adapter' or switch to dynamic import.
ERR_REQUIRE_ESM
Trying to require() an ESM-only package in a CommonJS module.
fix
Convert your project to ESM or use import() inside an async function.
Module not found: Can't resolve 'cachified-redis-json-adapter'
Package not installed or not in node_modules.
fix
Run npm install cachified-redis-json-adapter @epic-web/cachified redis (or appropriate package manager).
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
@epic-web/cachifiedrequiredPeer dependency – adapter is designed to be used with cachified's caching API.
redis-jsonrequiredPeer dependency – requires a redis-json client instance to be passed to the adapter.
Agent activity
11 hits · last 30 days
node
9
OpenAI (training)
1
Resources
cachified-redis-json-adapter — npm install cachified-redis-json-adapter · libregistry