![New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions](https://cdn.sanity.io/images/cgdhsj6q/production/86e6ebdea652d20da070ebbda20134b839972db7-1024x1024.webp?w=800&fit=max&auto=format)
Security News
New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
@redis/client
Advanced tools
Package description
@redis/client is a Node.js client for Redis, a powerful in-memory data structure store. This package allows you to interact with a Redis server to perform various operations such as setting and getting keys, managing data structures like lists and sets, and handling pub/sub messaging.
Basic Key-Value Operations
This feature allows you to perform basic key-value operations such as setting and getting values from the Redis store.
const { createClient } = require('@redis/client');
(async () => {
const client = createClient();
await client.connect();
await client.set('key', 'value');
const value = await client.get('key');
console.log(value); // Output: 'value'
await client.disconnect();
})();
Data Structures
This feature allows you to manage complex data structures like lists. The example demonstrates how to push values to a list and retrieve them.
const { createClient } = require('@redis/client');
(async () => {
const client = createClient();
await client.connect();
await client.lPush('list', 'value1');
await client.lPush('list', 'value2');
const list = await client.lRange('list', 0, -1);
console.log(list); // Output: ['value2', 'value1']
await client.disconnect();
})();
Pub/Sub Messaging
This feature allows you to use Redis's pub/sub messaging capabilities. The example shows how to publish a message to a channel and subscribe to that channel to receive messages.
const { createClient } = require('@redis/client');
(async () => {
const publisher = createClient();
const subscriber = createClient();
await publisher.connect();
await subscriber.connect();
await subscriber.subscribe('channel', (message) => {
console.log(message); // Output: 'Hello, World!'
});
await publisher.publish('channel', 'Hello, World!');
// Give some time for the message to be received
setTimeout(async () => {
await publisher.disconnect();
await subscriber.disconnect();
}, 1000);
})();
ioredis is another popular Redis client for Node.js. It supports both callback and Promise-based APIs and offers advanced features like cluster support and Lua scripting. Compared to @redis/client, ioredis is known for its high performance and extensive feature set.
redis is the original Node.js client for Redis. It is simple and easy to use, making it a good choice for basic Redis operations. However, it may lack some of the advanced features and performance optimizations found in @redis/client and ioredis.
node-redis is a modern, high-performance Redis client for Node.js. It offers a comprehensive set of features, including support for Redis modules and TypeScript. It is similar to @redis/client in terms of functionality but may offer better performance and additional features.
Readme
The source code and documentation for this package are in the main node-redis repo.
FAQs
The source code and documentation for this package are in the main [node-redis](https://github.com/redis/node-redis) repo.
The npm package @redis/client receives a total of 1,633,371 weekly downloads. As such, @redis/client popularity was classified as popular.
We found that @redis/client demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
Security News
Results from the 2023 State of JavaScript Survey highlight key trends, including Vite's dominance, rising TypeScript adoption, and the enduring popularity of React. Discover more insights on developer preferences and technology usage.
Security News
The US Justice Department has penalized two consulting firms $11.3 million for failing to meet cybersecurity requirements on federally funded projects, emphasizing strict enforcement to protect sensitive government data.