Home

Redis

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.

Repository

https://github.com/okeeffed/developer-notes-nextjs/content/redis/redis-overview

Sections


Related