🎉 I'm releasing 12 products in 12 months! If you love product, checkout my new blog workingoutloud.dev

Back to home

Redis CLI Basics

    tl;dr

    Hash Sets

    CommandFunctionExample
    HGETALLGet all fields and values in hashHGETALL coin:btc
    HKEYSGet all fields in hashHKEYS coin:btc
    HGETGet value of hash fieldHGET coin:btc id
    HMGETMultiple get value of hash fieldHGET coin:btc id buy sell
    HSETSet value of hash fieldHSET coin:btc id 1234
    HMSETMultiple set value of hash fieldHSET coin:btc id ID1234 buy 123 sell 100

    Lists

    CommandFunctionExample
    RPUSHPush elements onto a listRPUSH list "one"
    LPOPPop element from last on listLPOP list
    LLENGet list lengthLLEN list

    Run local server and attach

    # terminal one redis-server /usr/local/etc/redis.conf # terminal two redis-cli

    Command list

    FunctionCommand
    Installbrew install redis
    Run serverredis-server /usr/local/etc/redis.conf
    Uninstallbrew uninstall redis && rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
    Infobrew info redis
    Run Redis CLI clientredis-cli

    Redis commands

    A full list can be found at https://redis.io/commands.

    Personal image

    Dennis O'Keeffe

    @dennisokeeffe92
    • Melbourne, Australia

    Hi, I am a professional Software Engineer. Formerly of Culture Amp, UsabilityHub, Present Company and NightGuru.
    I am currently working on Visibuild.

    1,200+ PEOPLE ALREADY JOINED ❤️️

    Get fresh posts + news direct to your inbox.

    No spam. We only send you relevant content.

    Redis CLI Basics

    Introduction

    Share this post