Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 2.95 KB

File metadata and controls

57 lines (37 loc) · 2.95 KB
title Azure API Management policy reference - cache-remove-value | Microsoft Docs
description Reference for the cache-remove-value policy available for use in Azure API Management. Provides policy usage, settings, and examples.
services api-management
author dlepow
ms.service azure-api-management
ms.topic reference
ms.date 07/23/2024
ms.author danlep

Remove value from cache

[!INCLUDE api-management-availability-all-tiers]

The cache-remove-value deletes a cached item identified by its key. The key can have an arbitrary string value and is typically provided using a policy expression.

[!INCLUDE api-management-policy-generic-alert]

Policy statement

<cache-remove-value key="cache key value" caching-type="prefer-external | external | internal"  />

Attributes

Attribute Description Required Default
caching-type Choose between the following values of the attribute:
- internal to use the built-in API Management cache,
- external to use the external cache as described in Use an external Redis-compatible cache in Azure API Management,
- prefer-external to use external cache if configured or internal cache otherwise.

Policy expressions aren't allowed.
No prefer-external
key The key of the previously cached value to be removed from the cache. Policy expressions are allowed. Yes N/A

Usage

Example

The following example shows how to use the cache-remove-value policy to remove a user profile from the cache. The key for the cache REMOVAL is constructed using a policy expression that combines a string with the value of the enduserid context variable.

<cache-remove-value
    key="@("userprofile-" + context.Variables["enduserid"])"  />

For more information and examples of this policy, see Custom caching in Azure API Management.

Related policies

[!INCLUDE api-management-policy-ref-next-steps]