Cache

Short Definition

Service consumers can cache and reuse response message data.

Long Definition

The data provided by a prior response message can be temporarily stored and reused by the service consumer for later request messages.

Application
  • Services must be designed to produce accurate cache control metadata and return it in response messages. Response messages are marked as cacheable or non-cacheable, either with explicit message metadata or as part of the contract definition.
  • An optional consumer-side or intermediary cache repository enables the consumer to reuse cacheable response data for later request messages.
  • Request messages must be comparable to determine whether or not they are equivalent.
  • Contracts must either include explicit statements about the cacheability of responses, or must allow for cache control metadata to be included in responses.
Impacts
  • Runtime efficiency is improved by eliminating the need for duplicate response messages to be transmitted and processed.
  • The cache provides a robust and simple mechanism to perform "lazy replication" of service state data to its consumers.
  • Some forms of cached data can become stale and outdated if not regularly checked and updated.
Relationship to REST

A number of established techniques for pushing data out to consumers are disallowed by the application of Client-Server and Stateless. The Cache constraint provides a mechanism that is permitted by other constraints and one that results in a simple and robust architecture for reusing and optimizing the distribution of data.

Related REST Goals

Performance, Scalability, Reliability (Negative)