Response Caching can be enabled for all HTTP routes (with explicit opt-out) or for specific routes.
To enable for all services, define your cache settings under 'http'.
You can also define caching for a specific route.
In-Memory and Redis Cache
For production, you should always be using redis for storing state. In-memory state exists primarily for development workflows. The default is in-memory state.
To store state in redis:
To store the state in memory, can leave the 'state' field undefined. However, if you want to be more explicit about it:
Varying by headers, query or body
Cached data can be stored separately for combinations of header, query or body fields. The following example caches for a combination of a specific header named 'userid' and a query parameter named 'location'.