Redis CLI Basics
tl;dr
Hash Sets
Command | Function | Example |
---|---|---|
HGETALL | Get all fields and values in hash | HGETALL coin:btc |
HKEYS | Get all fields in hash | HKEYS coin:btc |
HGET | Get value of hash field | HGET coin:btc id |
HMGET | Multiple get value of hash field | HGET coin:btc id buy sell |
HSET | Set value of hash field | HSET coin:btc id 1234 |
HMSET | Multiple set value of hash field | HSET coin:btc id ID1234 buy 123 sell 100 |
Lists
Command | Function | Example |
---|---|---|
RPUSH | Push elements onto a list | RPUSH list "one" |
LPOP | Pop element from last on list | LPOP list |
LLEN | Get list length | LLEN list |
Run local server and attach
# terminal one redis-server /usr/local/etc/redis.conf # terminal two redis-cli
Command list
Function | Command |
---|---|
Install | brew install redis |
Run server | redis-server /usr/local/etc/redis.conf |
Uninstall | brew uninstall redis && rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist |
Info | brew info redis |
Run Redis CLI client | redis-cli |
Redis commands
A full list can be found at https://redis.io/commands
Dennis O'Keeffe
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.