liveBook · Manning

Caching

As explained in Microservices Patterns, Second Edition

A caching pattern stores previously obtained data so that subsequent requests can be served without accessing the original provider.

Caching stores previously obtained responses so later requests can avoid contacting the original provider, reducing load and latency. In synchronous service communication, it can also help a caller return a useful response when a downstream service is unavailable. section 8.2.4

In API composition, a provider proxy can cache service responses and query its cache when the provider is unavailable. Because clients often need fresh data, caching is more useful here as a fallback than as a routine response path. Cached data may be stale, and the proxy needs a meaningful cache key. section 12.3.3

Order details during a service outage

If the Delivery Service is unavailable, an API gateway serving an order endpoint can return cached delivery information instead of leaving that part of the response unavailable. section 8.2.4

Figure 8.8 An API gateway that implements an endpoint using API composition can use the fallback pattern to return a useful response even when one or more of the services it calls are unavailable. For example, if the Delivery Service is unavailable, the GET /orders/{orderId} endpoint can return a response containing either empty or cached delivery information.
API Gateway Circuit Breaker Composition

Shows an API-composition response using empty or cached delivery information when the Delivery Service is unavailable. section 8.2.4

How Microservices Patterns, Second Edition covers it

How deep it goes
Defines cached-response use and provider-proxy fallback, noting stale data and meaningful cache keys without explaining cache construction.
Examples
Illustrates cached delivery information in an order response when the Delivery Service is unavailable.
What you can do after
Apply caching by storing provider responses in a proxy and querying them when the provider is unavailable.
How it connects
Connects caching with fallback, API composition, provider proxies, and synchronous service communication.

Also explained in

Compare how 49 books explain caching →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.