DEV Community

Cover image for ##Redis Rapid Reference: Mastering All Commands with PowerShell 🚀💡✨🔮
Shubham Srivastava
Shubham Srivastava

Posted on

##Redis Rapid Reference: Mastering All Commands with PowerShell 🚀💡✨🔮

Redis Documentation

Welcome to the Redis documentation! Redis is an open-source, in-memory data structure store used as a database, cache, and message broker. It supports various data structures such as:

  • Strings
  • Hashes
  • Lists
  • Sets
  • Sorted sets
  • Bitmaps
  • Hyperloglogs
  • Geospatial indexes with radius queries

In this documentation, we'll cover basic commands and functionalities of Redis using the provided PowerShell commands. 🚀💡

Getting Started

First, make sure you have Docker installed on your system to run Redis in a containerized environment.

Install Docker

Follow the instructions on the official Docker website to install Docker on your system: https://docs.docker.com/get-docker/

Table of Contents

  1. Introduction to Redis 🌟
  2. SET and GET Commands 🔧
  3. SETNX Command 🛡️
  4. MSET and MGET Commands 🚀
  5. LPUSH and LPOP Commands 🔄
  6. SADD Command ➕
  7. ZADD and ZRANGE Commands 📊
  8. HSET Command 🏷️
  9. PUBLISH Command 📢
  10. SUBSCRIBE Command 📡

Introduction to Redis

Redis is a powerful, open-source, in-memory data structure store known for its performance and versatility. It supports various data structures like strings, hashes, lists, sets, and more, making it ideal for caching, real-time analytics, messaging queues, and much more.

SET and GET Commands

  • SET: Set a key to hold a string value.
  127.0.0.1:6379> SET name shubham
  OK
🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด
  • GET: Get the value of a key.
  127.0.0.1:6379> GET name
  "shubham"
🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด

SETNX Command

  • SETNX: Set the value of a key, only if the key does not exist.
  127.0.0.1:6379> SETNX user:4 Ayush NX
  OK
🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด

MSET and MGET Commands

  • MSET: Set multiple keys to multiple values in a single atomic operation.
  • MGET: Retrieve the values of multiple keys.
  127.0.0.1:6379> MSET id:1 "hey" id:2 "hello"
  OK
  127.0.0.1:6379> MGET id:1 id:2
  1) "hey"
  2) "hello"
🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด

LPUSH and LPOP Commands

  • LPUSH: Add one or more values to the beginning of a list.
  • LPOP: Remove and return the first element of a list.
  127.0.0.1:6379> LPUSH messages hey
  (integer) 1
  127.0.0.1:6379> LPOP messages
  "hey"
🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด

SADD Command

  • SADD: Add one or more members to a set.
  127.0.0.1:6379> SADD ip 1
  (integer) 1
🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด

ZADD and ZRANGE Commands

  • ZADD: Add one or more members to a sorted set.
  • ZRANGE: Return a range of members in a sorted set.
  127.0.0.1:6379> ZADD no 1 shubham
  (integer) 1
  127.0.0.1:6379> ZRANGE no 0 -1
  1) "shubham"
🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด

HSET Command

  • HSET: Set fields in a hash stored at a specified key.
  127.0.0.1:6379> HSET bike:1 model Deimos brand Ergonom type 'Enduro bikes' price 4972
  (integer) 4
🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด

PUBLISH Command

  • PUBLISH: Publish a message to channels.
  127.0.0.1:6379> PUBLISH notifications hey
  (integer) 1
🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด

SUBSCRIBE Command

  • SUBSCRIBE: Subscribe to channels.
  127.0.0.1:6379> SUBSCRIBE notifications
  1) "subscribe"
  2) "notifications"
  3) (integer) 1
🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: surajvast/redis rapid reference mastering all commands with powershell b - สรุปดราม่าล่าสุด

Congratulations! You have successfully learned some basic Redis commands and functionalities. Redis offers a wide range of features for managing and manipulating data efficiently. Explore further to unlock the full potential of Redis in your applications.

🚀 Happy coding with Redis! 🎉

Top comments (0)