@gradientedge/cdk-utils 9.78.0 → 9.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -226,28 +226,27 @@ class AzureApiManagementManager {
|
|
|
226
226
|
</when>
|
|
227
227
|
</choose>
|
|
228
228
|
</when>
|
|
229
|
+
<when condition="@((string)context.Variables["bypassCache"] == "true")">
|
|
230
|
+
<cache-remove-value key="@((string)context.Variables["customCacheKey"])" />
|
|
231
|
+
</when>
|
|
229
232
|
</choose>`;
|
|
230
|
-
cacheSetOutboundPolicy =
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
<
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
<set-header name="X-Apim-Cache-Status" exists-action="override">
|
|
238
|
-
<value>MISS</value>
|
|
239
|
-
</set-header>
|
|
240
|
-
</when>
|
|
241
|
-
</choose>
|
|
242
|
-
<!-- Add debug headers -->
|
|
243
|
-
<set-header name="X-Apim-Cache-Key" exists-action="override">
|
|
244
|
-
<value>@((string)context.Variables["customCacheKey"])</value>
|
|
245
|
-
</set-header>
|
|
246
|
-
<set-header name="X-Apim-API-Name" exists-action="override">
|
|
247
|
-
<value>@(context.Api.Name)</value>
|
|
233
|
+
cacheSetOutboundPolicy = `<!-- Store the response body in cache -->
|
|
234
|
+
<choose>
|
|
235
|
+
<when condition="@(context.Response.StatusCode == 200)">
|
|
236
|
+
<cache-store-value key="@((string)context.Variables["customCacheKey"])" value="@(context.Response.Body.As<string>(preserveContent: true))" duration="${operation.caching.ttlInSecs ?? 900}" />
|
|
237
|
+
<!-- Add cache status header -->
|
|
238
|
+
<set-header name="X-Apim-Cache-Status" exists-action="override">
|
|
239
|
+
<value>MISS</value>
|
|
248
240
|
</set-header>
|
|
249
241
|
</when>
|
|
250
|
-
</choose
|
|
242
|
+
</choose>
|
|
243
|
+
<!-- Add debug headers -->
|
|
244
|
+
<set-header name="X-Apim-Cache-Key" exists-action="override">
|
|
245
|
+
<value>@((string)context.Variables["customCacheKey"])</value>
|
|
246
|
+
</set-header>
|
|
247
|
+
<set-header name="X-Apim-API-Name" exists-action="override">
|
|
248
|
+
<value>@(context.Api.Name)</value>
|
|
249
|
+
</set-header>`;
|
|
251
250
|
}
|
|
252
251
|
if (operation.caching.enableCacheInvalidation) {
|
|
253
252
|
cacheInvalidateInboundPolicy = `<set-variable name="clearCache" value="@(context.Request.Headers.GetValueOrDefault("X-Apim-Clear-Cache", "false").ToLower())" />
|
package/package.json
CHANGED
|
@@ -273,28 +273,27 @@ export class AzureApiManagementManager {
|
|
|
273
273
|
</when>
|
|
274
274
|
</choose>
|
|
275
275
|
</when>
|
|
276
|
+
<when condition="@((string)context.Variables["bypassCache"] == "true")">
|
|
277
|
+
<cache-remove-value key="@((string)context.Variables["customCacheKey"])" />
|
|
278
|
+
</when>
|
|
276
279
|
</choose>`
|
|
277
|
-
cacheSetOutboundPolicy =
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
<
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
<set-header name="X-Apim-Cache-Status" exists-action="override">
|
|
285
|
-
<value>MISS</value>
|
|
286
|
-
</set-header>
|
|
287
|
-
</when>
|
|
288
|
-
</choose>
|
|
289
|
-
<!-- Add debug headers -->
|
|
290
|
-
<set-header name="X-Apim-Cache-Key" exists-action="override">
|
|
291
|
-
<value>@((string)context.Variables["customCacheKey"])</value>
|
|
292
|
-
</set-header>
|
|
293
|
-
<set-header name="X-Apim-API-Name" exists-action="override">
|
|
294
|
-
<value>@(context.Api.Name)</value>
|
|
280
|
+
cacheSetOutboundPolicy = `<!-- Store the response body in cache -->
|
|
281
|
+
<choose>
|
|
282
|
+
<when condition="@(context.Response.StatusCode == 200)">
|
|
283
|
+
<cache-store-value key="@((string)context.Variables["customCacheKey"])" value="@(context.Response.Body.As<string>(preserveContent: true))" duration="${operation.caching.ttlInSecs ?? 900}" />
|
|
284
|
+
<!-- Add cache status header -->
|
|
285
|
+
<set-header name="X-Apim-Cache-Status" exists-action="override">
|
|
286
|
+
<value>MISS</value>
|
|
295
287
|
</set-header>
|
|
296
288
|
</when>
|
|
297
|
-
</choose
|
|
289
|
+
</choose>
|
|
290
|
+
<!-- Add debug headers -->
|
|
291
|
+
<set-header name="X-Apim-Cache-Key" exists-action="override">
|
|
292
|
+
<value>@((string)context.Variables["customCacheKey"])</value>
|
|
293
|
+
</set-header>
|
|
294
|
+
<set-header name="X-Apim-API-Name" exists-action="override">
|
|
295
|
+
<value>@(context.Api.Name)</value>
|
|
296
|
+
</set-header>`
|
|
298
297
|
}
|
|
299
298
|
|
|
300
299
|
if (operation.caching.enableCacheInvalidation) {
|