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 cacheUtils = require('alien-node-redis-utils')(redisClient);
✗ const cacheUtils = require('alien-node-redis-utils');
The package exports a function that must be called with a Redis client instance.
getItem
✓ const cacheUtils = require('alien-node-redis-utils')(redisClient); cacheUtils.getItem('key');
✗ const { getItem } = require('alien-node-redis-utils')(redisClient);
Methods are not directly exported; use the returned object.
setItem
✓ const cacheUtils = require('alien-node-redis-utils')(redisClient); cacheUtils.setItem('key', expire, data);
✗ const cacheUtils = require('alien-node-redis-utils'); cacheUtils.setItem('key', expire, data);
Must initialize with redisClient first.
Shows how to initialize the library with a Redis client, set an item with TTL, then retrieve it.
const redis = require('redis');
const redisClient = redis.createClient();
const cacheUtils = require('alien-node-redis-utils')(redisClient);
const cacheKey = 'myKey';
const expire = 3600;
const data = { hello: 'world' };
cacheUtils.setItem(cacheKey, expire, data)
.then(() => cacheUtils.getItem(cacheKey))
.then(result => console.log(result))
.catch(err => console.error(err));
Errors
Common errors & fixes
TypeError: cacheUtils.getItem is not a function
Forgetting to call the exported function with redisClient.
fixconst cacheUtils = require('alien-node-redis-utils')(redisClient); ReplyError: ERR value is not an integer or out of range
Passing milliseconds as expire instead of seconds.
fixEnsure expire is in seconds (e.g., 3600 for 1 hour).
Audit
Dependencies
ramdarequiredUsed for currying and functional utilities
redisrequiredPeer dependency for Redis client