Redis and Memcached Overview

Choose an in-memory tool for the work you actually need

Reusable values and structured operations

Replaceable key/value copiesSimple get, miss and reload workflow
Structured in-memory operationsCounters, membership and ordered structures
Both paths need memory budgets, expiry or eviction rules, access control and recovery.
A simple cached value can avoid a database read. A structured counter or set has different command and correctness needs. Both consume memory and require an operating plan.

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

You need replaceable rendered fragments with an authoritative database behind them.
You need server-side sorted membership and counters.

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.

Every option and consequence stays visible. Choose an option in each situation to build a revisable decision record.

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

A replaceable cache entry disappears after eviction. What must the application be prepared to do?
Choose one answer. You can try again.

Answer and explanation

Reload or recompute it from the authoritative source, with backend load controlled.

A cache miss is an expected part of a replaceable cache design.

Check your design decision

Does enabling a replication feature alone prove that every acknowledged write survives every failure?
Choose one answer. You can try again.

Answer and explanation

No. Inspect persistence, acknowledgement and failover guarantees for the deployment.

Redundancy and durability depend on the actual contract and failure scope.

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.

    Next lesson: Message Queues (e.g., Kafka, RabbitMQ) →