Registry / storage / feathers-redis-cache

feathers-redis-cache

JSON →
library1.2.2jsnpmunverified

Redis caching hooks for Feathers.js services, version 1.2.2. This package provides before/after hooks to cache API responses in Redis, supporting per-route and group-based cache purging. It is a fork of feathers-hooks-rediscache with simplified API, pagination support, custom cache key generation, and configurable logger. Designed for HTTP endpoints in clustered Feathers applications where in-memory caching would be duplicated across nodes. Release cadence is low; last release was a patch update. Alternatives include feathers-hooks-rediscache (original, less feature-rich).

npm install feathers-redis-cache
INSTALL
IMPORT
SIG · FEATHERS-REDIS-CAC
F
feathers-redis-cache
storagejavascriptv1.2.2
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.

before
✓ import { before } from 'feathers-redis-cache'
✗ const { before } = require('feathers-redis-cache')
CommonJS require is supported but TypeScript/ESM is preferred. Ensure Node.js version supports ESM.
after
✓ import { after } from 'feathers-redis-cache'
✗ import { afterCache } from 'feathers-redis-cache'
The exported hook is named 'after', not 'afterCache' or 'cacheAfter'.
purge
✓ import { purge } from 'feathers-redis-cache'
Used in after create/update/patch/remove hooks to clear the cache group.

Basic Feathers.js app with Redis caching for find/get and cache purging on mutations.

import { before, after, purge } from 'feathers-redis-cache'; import feathers from '@feathersjs/feathers'; import express from '@feathersjs/express'; const app = express(feathers()); app.use('/messages', service); app.service('messages').hooks({ before: { find: [before()], get: [before()] }, after: { find: [after({ expiration: 3600 })], get: [after({ expiration: 3600 })], create: [purge()], patch: [purge()], update: [purge()], remove: [purge()] } }); app.listen(3030);
Debug
Known issues
breakingThe fork changed the API: removed options like 'parseNestedRoutes', 'removePathFromCacheKey', 'defaultDuration', 'immediateCacheKey'. Custom expiration must be passed in after hook options.
fix
Update code to not use removed options; pass expiration in after({ expiration: seconds }).
affects: >=1.0.0
breakingRemoved 'hookCache' option; custom expiration no longer set in before hook.
fix
Set expiration in after hook options instead of before hook.
affects: >=1.0.0
breakingRemoved 'redisCache' from config; use standard 'redis' config key or default Redis config.
fix
Ensure config.json uses 'redis' key instead of 'redisCache'.
affects: >=1.0.0
deprecatedThe original package 'feathers-hooks-rediscache' is deprecated in favor of this fork.
fix
Migrate to 'feathers-redis-cache' and update hook imports.
affects: >=0.0.0
gotchaCache keys are generated in before hook; query params affect caching. Different params produce different cache keys.
fix
Be aware that caching varies by URL and query string; plan purge strategy accordingly.
affects: >=0.0.0
gotchaNot tested with sockets; intended for HTTP usage only.
fix
Use only over HTTP; consider alternatives for socket-based caching.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'feathers-redis-cache'
Package not installed or missing from node_modules.
fix
Run npm install feathers-redis-cache or yarn add feathers-redis-cache.
TypeError: before is not a function
Incorrect import: likely imported as default instead of named export.
fix
Use named import: import { before } from 'feathers-redis-cache'.
Redis connection error: connect ECONNREFUSED 127.0.0.1:6379
Redis server is not running or config not set.
fix
Start Redis server or configure redis host/port in config/default.json under 'redis' key.
Upgrade
Version history
1.2.2latest on npm
Audit
Dependencies
redisrequiredProvides Redis client for caching operations
Agent activity
27 hits · last 30 days
node
24
Amazon
1
Resources
feathers-redis-cache — npm install feathers-redis-cache · libregistry