Big Data & Tools with NoSQL
  • Big Data & Tools
  • ReadMe
  • Big Data Overview
    • Overview
    • Job Opportunities
    • What is Data?
    • How does it help?
    • Types of Data
    • The Big 4 V's
      • Variety
      • Volume
      • Velocity
      • Veracity
      • Other V's
    • Trending Technologies
    • Big Data Concerns
    • Big Data Challenges
    • Data Integration
    • Scaling
      • CAP Theorem
      • Optimistic concurrency
      • Eventual consistency
      • Concurrent vs. Parallel Programming
    • Big Data Tools
    • No SQL Databases
    • What does Big Data learning means?
  • Linux & Tools
    • Overview
    • Linux Commands - 01
    • Linux Commands - 02
    • AWK
    • CSVKIT
    • CSVSQL
    • CSVGREP
  • Data Format
    • Storage Formats
    • CSV/TSV/Parquet
    • Parquet Example
    • JSON
    • HTTP & REST API
      • Terms to Know
        • Statefulness
        • Statelessness
        • Monolithic Architecture
        • Microservices
        • Idempotency
    • REST API
    • Python
      • Setup
      • Decorator
      • Unit Testing
      • Flask Demo
      • Flask Demo - 01
      • Flask Demo - 02
      • Flask Demo - 03
      • Flask Demo - 04
      • Flask Demo - 06
    • API Testing
    • Flask Demo Testing
    • API Performance
    • API in Big Data World
  • NoSQL
    • Types of NoSQL Databases
    • Redis
      • Overview
      • Terms to know
      • Redis - (RDBMS) MySql
      • Redis Cache Demo
      • Use Cases
      • Data Structures
        • Strings
        • List
        • Set
        • Hash
        • Geospatial Index
        • Pub/Sub
        • Redis - Python
      • Redis JSON
      • Redis Search
      • Persistence
      • Databases
      • Timeseries
    • Neo4J
      • Introduction
      • Neo4J Terms
      • Software
      • Neo4J Components
      • Hello World
      • Examples
        • MySQL: Neo4J
        • Sample Transactions
        • Sample
        • Create Nodes
        • Update Nodes
        • Relation
        • Putting it all together
        • Commonly used Functions
        • Data Profiling
        • Queries
        • Python Scripts
      • More reading
    • MongoDB
      • Sample JSON
      • Introduction
      • Software
      • MongoDB Best Practices
      • MongoDB Commands
      • Insert Document
      • Querying MongoDB
      • Update & Remove
      • Import
      • Logical Operators
      • Data Types
      • Operators
      • Aggregation Pipeline
      • Further Reading
      • Fun Task
        • Sample
    • InfluxDB
      • Data Format
      • Scripts
  • Python
    • Python Classes
    • Serialization-Deserialization
  • Tools
    • JQ
    • DUCK DB
    • CICD Intro
    • CICD Tools
      • CI YAML
      • CD Yaml
    • Containers
      • VMs or Containers
      • What container does
      • Podman
      • Podman Examples
  • Cloud Everywhere
    • Overview
    • Types of Cloud Services
    • Challenges of Cloud Computing
    • High Availability
    • Azure Cloud
      • Services
      • Storages
      • Demo
    • Terraform
  • Data Engineering
    • Batch vs Streaming
    • Kafka
      • Introduction
      • Kafka Use Cases
      • Kafka Software
      • Python Scripts
      • Different types of Streaming
    • Quality & Governance
    • Medallion Architecture
    • Data Engineering Model
    • Data Mesh
  • Industry Trends
    • Roadmap - Data Engineer
    • Good Reads
      • IP & SUBNET
Powered by GitBook
On this page
  1. NoSQL
  2. Redis
  3. Data Structures

Strings

-- Single Namespace

SET "rachel" "Fashion"
GET "rachel"
STRLEN "rachel"
APPEND "rachel" " Designer"

GET "rachel"

#get first 5 letters
GETRANGE "rachel" 0 4

#Skip last 2 (extreme right is -1 and -2 and so on)
GETRANGE "rachel" 0 -3

# Substring
GETRANGE "rachel" 5 8

# Get the last 5 letters

GETRANGE "rachel" -5 -1 
-- Two Namespaces

SET "character:rachel" "Fashion"
GET "character:rachel"
STRLEN "character:rachel"
APPEND "character:rachel" " Designer"
GETRANGE "character:rachel" 0 4

SET "character:ross" "Palentologist"
-- Get all characters

KEYS character:*

Using KEYS will block the server when scanning for all the data. This might lead to latency in large databases and can affect other users. It is not to be used in Production.

-- Three Namespaces

SET "character:rachel:job" "Fashion"
GET "character:rachel:job"
STRLEN "character:rachel:job"
APPEND "character:rachel:job" " Designer"
GETRANGE "character:rachel:job" 0 4
  1. SETNX: Sets the value of a key only if the key does not exist.

    SETNX "character:rachel" "Fashion"

  2. SETEX: Sets the value of a key with an expiration time.

    SETEX "character:rachel" 60 "Fashion" (expires in 60 seconds)

  3. MSET: Sets multiple keys to multiple values in a single atomic operation.

    MSET "character:rachel" "Fashion" "character:ross" "Paleontologist"

  4. MGET: Gets the values of all the given keys.

    MGET "character:rachel" "character:ross"

  5. INCR: Increments the integer value of a key by one.

    INCR "pageviews:rachelProfile" GET "pageviews:rachelProfile"

  6. DECR: Decrements the integer value of a key by one.

    DECR "stock:centralPerkMugs"

  7. INCRBY: Increments the integer value of a key by the given amount.

    INCRBY "followers:rachel" 10

  8. DECRBY: Decrements the integer value of a key by the given number.

    DECRBY "debt:rachel" 100

  9. INCRBYFLOAT: Increments the float value of a key by the given amount.

    INCRBYFLOAT "balance:rachel" 100.50

  10. GETSET: Sets a new value and returns the old value.

    GETSET "character:rachel" "Executive"

  11. MSETNX: Sets multiple keys to multiple values only if none exist.

    MSETNX "character:rachel" "Fashion" "character:monica" "Chef"

  12. PSETEX: Similar to SETEX PSETEX but with an expiration time in milliseconds.

    PSETEX "character:rachel" 60000 "Fashion" (expires in 60,000 milliseconds or 60 seconds)

PreviousData StructuresNextList

Last updated 1 year ago