Redis and Memcached Overview
Choose an in-memory tool for the work you actually need
Reusable values and structured operations
Your application repeatedly reads the same small values. Keeping reusable copies in memory can avoid expensive repeated work. Redis and Memcached are common tools for this role, but their features and operating models are different.
Memcached primarily serves a key/value caching role. Redis offers richer data structures and optional persistence and replication capabilities. Features vary by version and deployment. A cache miss or failure still needs defined application behaviour.
What you’ll learn
- Compare simple reusable values with richer atomic data operations.
- Choose around durability, eviction and recovery rather than product popularity.
- Plan a representative workload test for a self-hosted or managed deployment.
Memcached fits replaceable key/value copies
An application can store a computed value under a key and fetch it later. If the value is absent, the application recomputes or reloads it from the authoritative source. Memcached includes operations beyond basic get/set, but it is not a general-purpose durable relational database.
Budget memory, item sizes, expirations and client routing. Entries may disappear due to eviction or node failure. If a cache node vanishes, the backing service must handle the misses without an uncontrolled overload.
Use it when the data is replaceable and the simple cache model meets the need. Application-level freshness, permissions and keys still require design.
Redis can do more than store an opaque value
Redis provides structures such as strings, hashes, lists, sets and sorted sets. A counter or membership operation can sometimes be performed by the server rather than fetching and rewriting a whole object in application code.
Atomicity of a supported command does not make an entire multi-step business flow atomic. Understand command, transaction, script and cluster boundaries for the selected deployment.
Persistence modes and replication change recovery behaviour, but do not remove every data-loss scenario. Decide which acknowledgements mean what, how failover works and whether a lost cache entry is acceptable.
Pick the feature and recovery contract first
Explore the design choices
Compare the visible consequences. With JavaScript enabled, choose an option in each scenario to assemble your decision record.
This is an exploratory design exercise. It does not run infrastructure, measure capacity or replace the lesson’s quiz.
Explore two common requirements. The options describe costs and responsibilities rather than assigning a universal winner.
The decisions are planning prompts, not a benchmark. For a real purchase or deployment, evaluate the chosen version’s features, licence, service terms and measured workload.
Size memory and plan a cold start
A stored value consumes more than its raw payload: keys, metadata and the chosen data structure add overhead. Replicas and persistence also use resources. Measure actual memory under realistic values and commands.
Choose eviction and expiration behaviour deliberately. Evicting a replaceable page fragment differs from losing an authoritative counter. Keep sensitive data access controlled and avoid exposing cache services directly to untrusted networks.
A cold cache may send much more work to the database. Use suitable limits, gradual warming or request coordination where needed. More cache memory cannot repair an incorrect cache key.
Compare real deployments and commercial choices
Memcached’s official documentation describes its cache model. Redis’s FAQ and replication documentation explain its broader capabilities and replication behaviour. Sources checked 6 October 2026.
Self-hosted software requires machines, upgrades and incident handling. Managed deployments can reduce some host maintenance while adding charges and service-specific limits. Verify licensing for the exact Redis version and distribution rather than assuming all historical versions have identical terms.
Benchmark realistic key sizes, command mix, connections, concurrency and failure recovery at the required latency and error rate. Published headline throughput is not a guarantee for your application.
Check your design decision
Check your design decision
Separate the tool from the access pattern
Apply Cache-Aside or a supported cache-write policy according to the required contract. For shared local object data, compare Flyweight rather than assuming a cache product is required.
Choose commands, semantics and operation together
Memcached offers a focused cache role; Redis offers richer operations and additional deployment options. Both need capacity, security and recovery planning.
Choose from the data’s meaning, required commands and actual guarantees. Measure your workload and keep replaceable copies distinct from authoritative state.
Reaching the recap and completing the quizzes are separate milestones.