A developer is configuring response caching for an API in Azure API Management. The developer applies the following policy configuration:
xml
<policies>
<inbound>
<base />
<cache-lookup vary-by-developer="false" vary-by-developer-groups="false" downstream-caching-type="none" />
<cache-store duration="3600" />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
</policies>
Why does this policy configuration fail to save?
- AThe cache-lookup policy is located in the inbound section, but it must be placed in the outbound section.
- BThe policy configuration fails because a user-assigned managed identity must be explicitly configured inside the cache-store element to authorize access to the cache.
- The cache-store policy is located in the inbound section, but it must be placed in the outbound section.Cevap
- DThe configuration fails because the duration attribute must reference a Key Vault secret via an access policy rather than using a hardcoded integer.
Cevap
The cache-store policy is located in the inbound section, but it must be placed in the outbound section.
The correct answer states that the cache-store policy is located in the inbound section, but it must be placed in the outbound section. Azure API Management policies execute in specific stages of the message lifecycle. The cache-lookup policy must be in the inbound section to intercept incoming requests and return a cached response if available. Conversely, the cache-store policy must be in the outbound section because it reads the HTTP response headers and body returned by the backend service to write them to the cache for future requests.
Adım Adım Çözüm
Anahtar Kavram
Azure API Management response caching policies must be placed in their correct execution sections: cache-lookup in inbound, and cache-store in outbound.