Caching Strategies Explained: Cache-Aside, Write-Through and Write-Back
Caching strategies and their trade-offs: cache-aside, read-through, write-through, write-back and write-around, plus eviction policies, TTLs and invalidation.
Event sourcing and CQRS explained: storing events instead of state, separate read and write models, audit trails and replay, costs and when to use them.

Event sourcing and CQRS are powerful patterns that often travel together. They solve real problems, and create new ones, so the key question is when they are worth it.
Instead of storing the current state of an entity, you store the sequence of events that led to it: AccountOpened, MoneyDeposited, MoneyWithdrawn. Current state is calculated by replaying the events.
Benefits:
Costs:
Command Query Responsibility Segregation separates:
Read models are updated from events, often asynchronously, so they are eventually consistent with the write model; see the CAP theorem and PACELC.
| Traditional CRUD | Event sourcing + CQRS | |
|---|---|---|
| Stored data | Current state | Event history (plus read models) |
| Audit trail | Added separately | Built in |
| Read performance | Depends on schema | Read models tuned per query |
| Consistency | Immediate | Read side usually eventual |
| Complexity | Low | High |
No. CQRS can be used with a normal database; the two are independent patterns that often complement each other.
Through read models or projections, built by processing events into query-friendly views.
No. Event-driven architecture is about services communicating via events; event sourcing is about storing state as events.
Every article is edited by a human and checked against our editorial policy. Spotted a mistake? Tell us.
Caching strategies and their trade-offs: cache-aside, read-through, write-through, write-back and write-around, plus eviction policies, TTLs and invalidation.
Rate limiting algorithms compared: fixed window, sliding log, sliding window counter, token bucket and leaky bucket, with code and distributed design tips.
Kafka, RabbitMQ and Amazon SQS compared: log vs queue models, ordering, replay, throughput, delivery guarantees and operations, and when to use each.