Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions src/lib/azure/services/api-management/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,28 +273,27 @@ export class AzureApiManagementManager {
</when>
</choose>
</when>
<when condition="@((string)context.Variables["bypassCache"] == "true")">
<cache-remove-value key="@((string)context.Variables["customCacheKey"])" />
</when>
</choose>`
cacheSetOutboundPolicy = `<choose>
<when condition="@((string)context.Variables["bypassCache"] != "true")">
<!-- Store the response body in cache -->
<choose>
<when condition="@(context.Response.StatusCode == 200)">
<cache-store-value key="@((string)context.Variables["customCacheKey"])" value="@(context.Response.Body.As<string>(preserveContent: true))" duration="${operation.caching.ttlInSecs ?? 900}" />
<!-- Add cache status header -->
<set-header name="X-Apim-Cache-Status" exists-action="override">
<value>MISS</value>
</set-header>
</when>
</choose>
<!-- Add debug headers -->
<set-header name="X-Apim-Cache-Key" exists-action="override">
<value>@((string)context.Variables["customCacheKey"])</value>
</set-header>
<set-header name="X-Apim-API-Name" exists-action="override">
<value>@(context.Api.Name)</value>
cacheSetOutboundPolicy = `<!-- Store the response body in cache -->
<choose>
<when condition="@(context.Response.StatusCode == 200)">
<cache-store-value key="@((string)context.Variables["customCacheKey"])" value="@(context.Response.Body.As<string>(preserveContent: true))" duration="${operation.caching.ttlInSecs ?? 900}" />
<!-- Add cache status header -->
<set-header name="X-Apim-Cache-Status" exists-action="override">
<value>MISS</value>
</set-header>
</when>
</choose>`
</choose>
<!-- Add debug headers -->
<set-header name="X-Apim-Cache-Key" exists-action="override">
<value>@((string)context.Variables["customCacheKey"])</value>
</set-header>
<set-header name="X-Apim-API-Name" exists-action="override">
<value>@(context.Api.Name)</value>
</set-header>`
}

if (operation.caching.enableCacheInvalidation) {
Expand Down