Why this matters
- VaultCommerce started with Memcached for HTML fragments, then migrated sessions and carts to Redis for TTL semantics and atomic operations.
- Picking Redis for pure byte caching wastes memory on features you never enable; picking Memcached when you need sorted sets forces awkward workarounds.
- Interviews compare the two with concrete VaultCommerce use cases, not feature checklists.
StringSessions, counters
ListQueues, feeds
SetUnique tags
Sorted SetLeaderboards
HashUser profiles
StreamEvent log
Memcached strengths
When Memcached fits
- Simple model — opaque key → byte array; no data types to learn.
- Multi-threaded — scales vertically on large machines without cluster complexity.
- Memory efficient — slab allocator reduces fragmentation for uniform object sizes.
- Stateless — losing a node means cache miss, not data loss (if DB is truth).
# Memcached: pure get/set
mc.set(b"fragment:homepage", rendered_html, expire=300)
html = mc.get(b"fragment:homepage")
VaultCommerce still uses Memcached for rendered category HTML fragments — large, uniform blobs with no need for lists, hashes, or pub/sub.
Redis strengths
When Redis fits
- Rich types — strings, lists, sets, sorted sets, hashes, streams.
- Atomic operations —
INCR,HINCRBY,LPUSHwithout race conditions. - Persistence — RDB snapshots and AOF for durability when needed.
- Replication and cluster — HA, failover, horizontal sharding.
- Pub/Sub and streams — lightweight messaging between services.
HSET cart:user_42 items "[{\"sku\":\"VC-HP-BLK\",\"qty\":1}]"
HINCRBY product:8842:views 1
ZADD leaderboard:sales 14999 "VC-HP-BLK"
VaultCommerce carts, sessions, rate limiters, and leaderboards live in Redis — operations that Memcached cannot express without application-level locking.
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
- Side-by-side comparison
- Memory and performance trade-offs
- Migration signal
Test yourself
Answer these before moving on — recall is what makes it stick.