SAA-C03
Deep Dive
Caching is fundamental to high-performance architectures. The exam tests when to use each type: ElastiCache for applications, DAX for DynamoDB, CloudFront for web content. It also tests caching patterns like lazy loading and write-through.
Contents
Caching reduces latency by storing frequently accessed data in memory — orders of magnitude faster than disk or a database. It also reduces load on the database, letting you serve more traffic with the same infrastructure.
~10 ms
Database (HDD)
~1 ms
Database (SSD)
~0.1 ms
In-memory (Redis)
| Feature | Redis | Memcached |
|---|---|---|
| Persistence | Yes (RDB + AOF snapshots) | No (memory only) |
| Replication / Multi-AZ | Yes — read replicas + failover | No |
| Clustering / Sharding | Cluster Mode (horizontal sharding) | Native multi-thread per node |
| Data structures | Strings, hashes, sets, sorted sets, lists, HyperLogLog | Simple strings only |
| Pub/Sub | Yes | No |
| Backup / Restore | Yes | No |
| Threads | Single-thread per core (Cluster Mode = multi-node) | Native multi-thread |
| Use case | Sessions, leaderboards, pub/sub, cache with HA | Simple object cache, multi-thread |
Choose Redis when...
Choose Memcached when...
Practical rule for the exam
If the question mentions any of these words → Redis: "sessions", "persistence", "Multi-AZ", "replication", "pub/sub", "sorted sets", "leaderboards". If it says "simple cache", "objects", "multi-thread", "no HA requirement" → Memcached.
DAX (DynamoDB Accelerator) is a fully managed in-memory cache cluster, purpose-built for DynamoDB. It reduces read latency from milliseconds to microseconds.
How it works
Your app uses the DAX SDK instead of the DynamoDB SDK
DAX first checks its in-memory cache
Cache hit: response in microseconds
Cache miss: DAX queries DynamoDB and caches the result
Your application code doesn't change — same DynamoDB API
DAX vs ElastiCache for DynamoDB
DAX
DynamoDB-specific cache. Transparent to the app. Understands the DynamoDB data model.
ElastiCache (Redis)
General-purpose cache. Requires app-level logic to manage the cache. Can cache results from multiple sources.
DAX signal in the exam
"Microsecond latency for DynamoDB" or "thousands of reads per second on DynamoDB" → DAX. DAX does not help with write operations.
CloudFront isn't just a CDN for static content — it also caches dynamic API responses and can dramatically reduce latency for global users.
Cache TTL
How long CloudFront caches an object. Set via Cache-Control or Expires headers from the origin, or via a CloudFront Cache Policy.
Cache Key
Which elements of the request make up the cache key. By default just the URL. Can include headers, cookies, or query strings.
Origin Shield
An extra caching layer between Edge Locations and the origin. Reduces origin requests by up to 60%.
Invalidations
Forces CloudFront to discard cached objects. Useful after deploying new versions of code/assets.
Lazy Loading (Cache-Aside)
You only cache on a cache miss. The app first checks the cache; if it's not there, it queries the DB and writes it into the cache.
Pros
+Only caches data that is actually used
+The cache can fail without breaking the app
Cons
-First access is slow (cache miss)
-Data can become stale
Write-Through
Every write to the DB also updates the cache. Cached data is always fresh.
Pros
+No stale data
+Cache is always warm for written data
Cons
-Slower writes (2 operations)
-May cache data that is never read
TTL — Time To Live
Every caching pattern should include a TTL to avoid stale data indefinitely. The ideal TTL depends on how often the data changes: user sessions (30 min), search results (5 min), user profile (1 hour), product catalog (24 hours).
Did you get this topic?
Test what you just learned
A web application has an RDS database with slow read queries that are hurting the user experience. The product catalog data rarely changes (1-2 times a day). Which caching pattern and service are most appropriate?
Put what you learned to the test with original SAA-C03 exam questions.
Start SAA-C03 mock examUnlimited mock exams with the Pro plan
Log in to track your progress.