
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
sequelize-redis
Advanced tools
A semi-automatic caching wrapper for Sequelize v4 NodeJS framework
npm install sequelize-redis
import SequelizeRedis from 'sequelize-redis';
import redis from 'redis';
import bluebird from 'bluebird';
// Let's promisify Redis
bluebird.promisifyAll(redis.RedisClient.prototype);
bluebird.promisifyAll(redis.Multi.prototype);
// Define your redisClient
const redisClient = redis.createClient({ /* Redis configuration comes here */ });
// Let's start
const sequelizeRedis = new SequelizeRedis(redisClient);
// models.User refers to model of sequelize
const User = sequelizeRedis.getModel(models.User, { ttl: 60 * 60 * 24 });
The second argument of getModel is optional:
| Key | Description | Default value |
|---|---|---|
| ttl | Defines cache TTL (seconds) | null |
const userUUID = '75292c75-4c7a-4a11-92ac-57f929f50e23';
const userCacheKey = `user_${userUUID}`;
// We can use the default sequelize methods by adding suffix of "Cached"
// for example, findbyPkCached:
const [user, cacheHit] = await User.findbyPkCached(userCacheKey, userUUID);
// We can also use the non cached methods (original methods)
const user = await User.findbyPk(userUUID);
Results of Cached methods (for ex. findbyPkCached) will be array with following arguments:
true / false)Supported Methods:
find
findOne
findAll
findAndCount
findAndCountAll
findbyPk
all
min
max
sum
count
Just use regular Redis API:
redisClient.del('SampleKey');
Feel free to contribute and submit issues.
Please make sure that your code is linted and getting build successfully
Inspired by rfink/sequelize-redis-cache/
MIT (Idan Gozlan)
FAQs
A semi-automatic caching wrapper for Sequelize NodeJS framework
The npm package sequelize-redis receives a total of 24 weekly downloads. As such, sequelize-redis popularity was classified as not popular.
We found that sequelize-redis demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.