Why this matters
- VaultCommerce product views use
INCRfor real-time counters, lists for audit trails, and sets for "customers who viewed this category." - Wrong type choice costs you: scanning a list for membership is O(n); a set gives O(1) lookups.
- These three types cover most cache-aside and lightweight queue patterns before you reach sorted sets and streams.
StringSessions, counters
ListQueues, feeds
SetUnique tags
Sorted SetLeaderboards
HashUser profiles
StreamEvent log
Strings: sessions and counters
Strings store text, integers, or binary up to 512 MB. Atomic increment/decrement makes them ideal for inventory and view counts without Postgres row locks.
SET session:tok_a8f2 "{\"userId\":42,\"role\":\"buyer\"}" EX 1800
GET session:tok_a8f2
INCR product:SKU-8842:views
INCRBY inventory:SKU-8842 -1
SETNX lock:checkout:42 "worker-7" EX 30
MSET promo:FLASH10 "active" promo:WELCOME "active"
MGET promo:FLASH10 promo:WELCOME
String commands VaultCommerce uses
SET key value EX seconds— write with TTL (sessions, cache entries).SETNX/SET ... NX— acquire a short-lived lock for idempotent checkout.INCR/INCRBY— atomic counters for views, stock reservations, rate limits.MGET— batch-read multiple product cache keys in one round trip.
The rest of this guide is part of Pro
Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.
Still to come · 3 sections
- Lists: recent activity feeds
- Sets: unique tags and audiences
- Python integration sketch
Test yourself
Answer these before moving on — recall is what makes it stick.