Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ioredis/commands

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ioredis/commands

Redis commands

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.1M
decreased by-2.86%
Maintainers
2
Weekly downloads
 
Created

What is @ioredis/commands?

@ioredis/commands is an npm package that provides a comprehensive list of Redis commands for use with the ioredis library. It allows developers to interact with Redis databases by executing various commands related to data manipulation, server management, and more.

What are @ioredis/commands's main functionalities?

String Operations

This feature allows you to perform basic string operations such as setting and getting the value of a key in Redis.

const Redis = require('ioredis');
const redis = new Redis();

// Set a key-value pair
redis.set('key', 'value');

// Get the value of a key
redis.get('key', (err, result) => {
  console.log(result); // 'value'
});

Hash Operations

This feature allows you to perform operations on hash data structures in Redis, such as setting and getting fields.

const Redis = require('ioredis');
const redis = new Redis();

// Set a field in a hash
redis.hset('hash', 'field', 'value');

// Get a field from a hash
redis.hget('hash', 'field', (err, result) => {
  console.log(result); // 'value'
});

List Operations

This feature allows you to perform operations on list data structures in Redis, such as pushing and popping values.

const Redis = require('ioredis');
const redis = new Redis();

// Push a value to a list
redis.lpush('list', 'value');

// Pop a value from a list
redis.rpop('list', (err, result) => {
  console.log(result); // 'value'
});

Set Operations

This feature allows you to perform operations on set data structures in Redis, such as adding members and checking membership.

const Redis = require('ioredis');
const redis = new Redis();

// Add a member to a set
redis.sadd('set', 'member');

// Check if a member exists in a set
redis.sismember('set', 'member', (err, result) => {
  console.log(result); // 1 if member exists, 0 otherwise
});

Pub/Sub

This feature allows you to use the publish/subscribe messaging paradigm in Redis, enabling you to send and receive messages between different parts of your application.

const Redis = require('ioredis');
const redis = new Redis();
const subscriber = new Redis();

// Subscribe to a channel
subscriber.subscribe('channel');

// Listen for messages
subscriber.on('message', (channel, message) => {
  console.log(`Received message: ${message} from channel: ${channel}`);
});

// Publish a message
redis.publish('channel', 'Hello, world!');

Other packages similar to @ioredis/commands

Keywords

FAQs

Package last updated on 25 Jun 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc