logoNEURAL COOK
SearchAll PostsTagsNotesAuthor
logoNEURAL COOK

A posts created with Next.js and Tailwind.css

Explore

  • All posts
  • Notes
  • Snippets
  • Tags
  • RSS feed

Connect

instagramlinkedinmailgithub

© 2026 VIKI. All rights reserved.

Built with
Contents
Design a Social-Media News Feed
API GatewayAPIBatchingCacheCAPConsistent HashingCounting At ScaleCQRSCRDTDatabase ScalingDatabase Selection StrategyDeployment StrategyDNSEvent SourcingHandling FailureVertical vs Horizontal ScalingHTTPId GenerationIndexesKafkaKubernetesLarge FilesLoad BalancingPaginationProxyReal Time PushRedisScaling ReadsStateless vs Stateful SystemsScaling Writes
System Design/topics

Cache

1 min read
On this pageCache-aside
Cache-asideHot KeyProduction improvementsSingle-flight/request coalescingTTL jitterStale-while-revalidateNegative cachingRefresh-aheadBounded fallbackHTTP Cache

# Cache-aside

# Hot Key

Cache invalidation is a consistency protocol

  • use versioned cache entries or conditional writes so that an older in-flight write can not overwrite a newer value.

# Production improvements

# Single-flight/request coalescing

one in-flight refresh per key, with a bounded number of waiters.

# TTL jitter

spread expiration times to prevent synchronized expiry.

# Stale-while-revalidate

serve stale data only where the freshness policy permits it.

# Negative caching

cache selected “not found” results briefly, while avoiding poisoning or stale authorization outcomes.

# Refresh-ahead

proactively refresh hot keys whose expiry would cause an expensive miss.

# Bounded fallback

Prevent every request from independently hitting the source during a cache failure.

# HTTP Cache

For shared HTTP caches, define Cache-Control, validators such as ETag, and variation behavior correctly. A GET request is not automatically safe to cache, and cache directives must align with the response's authorization semantics.

←PreviousBatchingNext→CAP

On this page

Cache-asideHot KeyProduction improvementsSingle-flight/request coalescingTTL jitterStale-while-revalidateNegative cachingRefresh-aheadBounded fallbackHTTP Cache