Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@redis/bloom | 1.2.0 | 8.98 kB | MIT | prod | 1 |
@redis/client | 1.5.11 | 90.9 kB | MIT | prod peer | |
@redis/graph | 1.1.0 | 5.64 kB | MIT | prod | 1 |
@redis/json | 1.0.6 | 5.21 kB | MIT | prod | |
@redis/search | 1.1.5 | 15.52 kB | MIT | prod | |
@redis/time-series | 1.0.5 | 8.98 kB | MIT | prod | |
cluster-key-slot | 1.1.2 | 5.13 kB | Apache-2.0 | prod | |
generic-pool | 3.9.0 | 18.81 kB | MIT | prod | |
redis | 4.6.10 | 9.31 kB | MIT | prod | |
yallist | 4.0.0 | 4.39 kB | ISC | prod |
Redis is a modern, high performance client for Redis that operates within a Node.js environment. It allows for quick and efficient interaction with a Redis database, offering built-in support for all out-of-the-box Redis commands. Node-Redis provides a platform for developers to interact with Redis using JavaScript, allowing for fast data handling, and efficient caching and storage solutions.
To use Redis within your Node.js applications, you first need to install it using npm with the command npm install redis
. After installation, you can import the redis module and create a new client using createClient()
. Here is a basic usage example:
import { createClient } from 'redis';
const client = await createClient()
.on('error', err => console.log('Redis Client Error', err))
.connect();
await client.set('key', 'value');
const value = await client.get('key');
await client.disconnect();
This example involves connecting to a local Redis server on port 6379, setting a key-value pair, retrieving the value of the key, and then disconnecting from the server.
The documentation for Redis can be found on multiple urls depending on the particular package. For instance, the documentation for the @redis/client package can be found at https://redis.js.org/documentation/client/. Other packages like @redis/bloom, @redis/graph, @redis/json, and @redis/search have their specific documentation as mentioned in the provided README file. This comprehensive documentation covers everything from setting up the client, to handling connections, running commands, using transactions, and more.