Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
@keyv/redis
Advanced tools
Readme
Redis storage adapter for Keyv
Redis storage adapter for Keyv.
TTL functionality is handled directly by Redis so no timestamps are stored and expired keys are cleaned up internally.
npm install --save keyv @keyv/redis
const Keyv = require('keyv');
const keyv = new Keyv('redis://user:pass@localhost:6379');
keyv.on('error', handleConnectionError);
Any valid Redis
options will be passed directly through.
e.g:
const keyv = new Keyv('redis://user:pass@localhost:6379', { disable_resubscribing: true });
Or you can manually create a storage adapter instance and pass it to Keyv:
const KeyvRedis = require('@keyv/redis');
const Keyv = require('keyv');
const keyvRedis = new KeyvRedis('redis://user:pass@localhost:6379');
const keyv = new Keyv({ store: keyvRedis });
Or reuse a previous Redis instance:
const KeyvRedis = require('@keyv/redis');
const Redis = require('ioredis');
const Keyv = require('keyv');
const redis = new Redis('redis://user:pass@localhost:6379');
const keyvRedis = new KeyvRedis(redis);
const keyv = new Keyv({ store: keyvRedis });
Or reuse a previous Redis cluster:
const KeyvRedis = require('@keyv/redis');
const Redis = require('ioredis');
const Keyv = require('keyv');
const redis = new Redis.Cluster('redis://user:pass@localhost:6379');
const keyvRedis = new KeyvRedis(redis);
const keyv = new Keyv({ store: keyvRedis });
The useRedisSets
option lets you decide whether to use Redis sets for key management. By default, this option is set to true
.
When useRedisSets
is enabled (true
):
clear
function), all keys in the Redis set are looked up for deletion. The set itself is also deleted.Note: In high-performance scenarios, enabling useRedisSets
might lead to memory leaks. If you're running a high-performance application or service, it is recommended to set useRedisSets
to false
.
If you decide to set useRedisSets
as false
, keys will be handled individually and Redis sets won't be utilized.
However, please note that setting useRedisSets
to false
could lead to performance issues in production when using the clear
function, as it will need to iterate over all keys to delete them.
Here's how you can use the useRedisSets
option:
const Keyv = require('keyv');
const keyv = new Keyv('redis://user:pass@localhost:6379', { useRedisSets: false });
MIT © Jared Wray
FAQs
Redis storage adapter for Keyv
The npm package @keyv/redis receives a total of 182,872 weekly downloads. As such, @keyv/redis popularity was classified as popular.
We found that @keyv/redis demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.