You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In addition to utilizing the built-in cache, Azure API Management allows for caching responses in an external Redis-compatible cache, such as Azure Cache for Redis.
18
+
In addition to utilizing the built-in cache, Azure API Management allows for caching responses in an external Redis-compatible cache, such as Azure Cache for Redis or Azure Managed Redis.
19
19
20
20
Using an external cache allows you to overcome a few limitations of the built-in cache:
21
21
@@ -29,7 +29,6 @@ For more detailed information about caching, see [API Management caching policie

33
32
34
33
What you'll learn:
35
34
@@ -42,18 +41,16 @@ To complete this tutorial, you need to:
42
41
43
42
+[Create an Azure API Management instance](get-started-create-service-instance.md)
44
43
+ Understand [caching in Azure API Management](api-management-howto-cache.md)
44
+
+ Have an [Azure Cache for Redis](../azure-cache-for-redis/quickstart-create-redis.md), [Azure Managed Redis](../azure-cache-for-redis/quickstart-create-managed-redis.md), or another Redis-compatible cache available.
45
45
46
-
## <aname="create-cache"> </a> Create Azure Cache for Redis
46
+
> [!IMPORTANT]
47
+
> Azure API Management uses a Redis connection string to connect to the cache. If you use Azure Cache for Redis or Azure Managed Redis, enable access key authentication in your cache to use a connection string. Currently, you can't use Microsoft Entra authentication to connect Azure API Management to Azure Cache for Redis or Azure Managed Redis.
47
48
48
-
This section explains how to create an Azure Cache for Redis in Azure. If you already have an Azure Cache for Redis, or another Redis-compatible cache within or outside of Azure, you can <ahref="#add-external-cache">skip</a> to the next section.
For an API Management self-hosted gateway, caching requires an external cache. For caching to be effective, a self-hosted gateway and the cache it relies on must be located close to each other to minimize lookup and store latencies. Deploying a Redis cache into the same Kubernetes cluster or in a separate cluster nearby are the best options. Learn how to [deploy Redis cache to a Kubernetes cluster](https://github.com/kubernetes/examples/tree/master/guestbook).
51
52
52
-
## <aname="create-cache"> </a> Deploy Redis cache to Kubernetes
53
-
54
-
For a self-hosted gateway, caching requires an external cache. For caching to be effective, a self-hosted gateway and the cache it relies on must be located close to each other to minimize lookup and store latencies. Deploying a Redis cache into the same Kubernetes cluster or in a separate cluster nearby are the best options. Learn how to [deploy Redis cache to a Kubernetes cluster](https://github.com/kubernetes/examples/tree/master/guestbook).
55
-
56
-
## <aname="add-external-cache"> </a>Add an external cache
53
+
## Add an external cache
57
54
58
55
Follow the steps below to add an external Redis-compatible cache in Azure API Management. You can limit the cache to a specific gateway in your API Management instance.
59
56
@@ -69,52 +66,52 @@ The **Use from** setting in the configuration specifies the location of your API
69
66
70
67
***Default**, to configure the cache as the default for all gateway locations in the API Management instance
71
68
72
-
A cache used for **Default**will be overridden by a cache used for a specific matching region or location.
69
+
A cache used for **Default**is overridden by a cache used for a specific matching region or location.
73
70
74
-
For example, consider an API Management instance that's hosted in the East US, Southeast Asia, and West Europe regions. There are two caches configured, one for **Default** and one for **Southeast Asia**. In this example, API Management in **Southeast Asia**will use its own cache, while the other two regions will use the **Default** cache entry.
71
+
For example, consider an API Management instance that's hosted in the East US, Southeast Asia, and West Europe regions. There are two caches configured, one for **Default** and one for **Southeast Asia**. In this example, API Management in **Southeast Asia**uses its own cache, while the other two regions use the **Default** cache entry.
75
72
76
73
> [!NOTE]
77
74
> You can configure the same external cache for more than one API Management instance. The API Management instances can be in the same or different regions. When sharing the cache for more than one instance, you must select **Default** in the **Use from** setting.
78
75
79
-
### Add an Azure Cache for Redis from the same subscription
76
+
### Add an Azure Cache for Redis or Azure Managed Redis instance from the same subscription
80
77
81
78
1. Browse to your API Management instance in the Azure portal.
82
-
2. Select the **External cache**tab from the menu on the left.
83
-
3. Select the **+ Add** button.
84
-
4. Select your cache in the **Cache instance** dropdown field.
85
-
5. Select **Default** or specify the desired region in the [**Use from**](#use-from-setting) dropdown field.
86
-
6. Select **Save**.
79
+
1. In the left menu, under **Deployment + infrastructure**select **External cache**.
80
+
1. Select **+ Add**.
81
+
1. In the **Cache instance** dropdown, select your cache.
82
+
1. In the [**Use from**](#use-from-setting) dropdown, select **Default** or specify the desired region. The **Connection string** is automatically populated.
83
+
1. Select **Save**.
87
84
88
85
### Add a Redis-compatible cache hosted outside of the current Azure subscription or Azure in general
89
86
90
87
1. Browse to your API Management instance in the Azure portal.
91
-
2. Select the **External cache**tab from the menu on the left.
92
-
3. Select the **+ Add** button.
93
-
4. Select **Custom** in the **Cache instance** dropdown field.
94
-
5. Select **Default** or specify the desired region in the [**Use from**](#use-from-setting) dropdown field.
95
-
6. Provide your Azure Cache for Redis (or Redis-compatible cache) connection string in the **Connection string** field.
96
-
7. Select **Save**.
88
+
1. In the left menu, under **Deployment + infrastructure**select **External cache**.
89
+
1. Select **+ Add**.
90
+
1. In the **Cache instance** dropdown, select **Custom**.
91
+
1. In the [**Use from**](#use-from-setting) dropdown, select **Default** or specify the desired region.
92
+
1. Enter your Azure Cache for Redis, Azure Managed Redis, or Redis-compatible cache connection string in the **Connection string** field.
93
+
1. Select **Save**.
97
94
98
95
### Add a Redis cache to a self-hosted gateway
99
96
100
-
1. Browse to your API Management instance in the Azure portal.
101
-
2. Select the **External cache** tab from the menu on the left.
102
-
3. Select the **+ Add** button.
103
-
4. Select **Custom** in the **Cache instance** dropdown field.
104
-
5. Specify the desired self-hosted gateway location or **Default** in the [**Use from**](#use-from-setting) dropdown field.
105
-
6. Provide your Redis cache connection string in the **Connection string** field.
106
-
7. Select **Save**.
97
+
1. In the left menu, under **Deployment + infrastructure** select **External cache**.
98
+
1. Select **+ Add**.
99
+
1. In the **Cache instance** dropdown, select **Custom**.
100
+
1. In the [**Use from**](#use-from-setting) dropdown, select **Default** or specify the desired region.
101
+
1. Enter your Redis cache connection string in the **Connection string** field.
102
+
1. Select **Save**.
107
103
108
104
## Use the external cache
109
105
110
106
After adding a Redis-compatible cache, configure [caching policies](api-management-policies.md#caching) to enable response caching, or caching of values by key, in the external cache.
111
107
112
108
For a detailed example, see [Add caching to improve performance in Azure API Management](api-management-howto-cache.md).
113
109
114
-
## <aname="next-steps"> </a>Next steps
110
+
## Related content
115
111
116
112
* For more information about caching policies, see [Caching policies][Caching policies] in the [API Management policy reference][API Management policy reference].
117
113
* To cache items by key using policy expressions, see [Custom caching in Azure API Management](api-management-sample-cache-by-key.md).
114
+
* Learn how to [enable semantic caching for Azure OpenAI APIs](azure-openai-enable-semantic-caching.md).
Copy file name to clipboardExpand all lines: articles/api-management/api-management-howto-cache.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,7 +89,7 @@ To see the caching in action, call an operation from the portal.
89
89
## Related content
90
90
* For more information about caching policies, see [Caching policies][Caching policies] in the [API Management policy reference][API Management policy reference].
91
91
* For information on caching items by key using policy expressions, see [Custom caching in Azure API Management](api-management-sample-cache-by-key.md).
92
-
* For more information about using external Azure Cache for Redis, see [Use an external Azure Cache for Redis in Azure API Management](api-management-howto-cache-external.md).
92
+
* For more information about using external Azure Cache for Redis or Azure Managed Redis, see [Use an external Azure Cache for Redis in Azure API Management](api-management-howto-cache-external.md).
Copy file name to clipboardExpand all lines: articles/api-management/api-management-key-concepts.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,6 +126,7 @@ API Management integrates with many complementary Azure services to create enter
126
126
***[Azure Defender for APIs](protect-with-defender-for-apis.md)** and **[Azure DDoS Protection](protect-with-ddos-protection.md)** for runtime protection against malicious attacks
127
127
***Microsoft Entra ID** for [developer authentication](api-management-howto-aad.md) and [request authorization](api-management-howto-protect-backend-with-aad.md)
128
128
***[Event Hubs](api-management-howto-log-event-hubs.md)** for streaming events
129
+
***[Azure Redis](api-management-howto-cache-external.md)** for caching responses with Azure Cache for Redis or Azure Managed Redis
129
130
* Several Azure compute offerings commonly used to build and host APIs on Azure, including **[Functions](import-function-app-as-api.md)**, **[Logic Apps](import-logic-app-as-api.md)**, **[Web Apps](import-app-service-as-api.md)**, **[Service Fabric](how-to-configure-service-fabric-backend.yml)**, and others including **[Azure OpenAI](azure-openai-api-from-specification.md)** service.
Copy file name to clipboardExpand all lines: articles/api-management/azure-openai-enable-semantic-caching.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ ms.service: azure-api-management
6
6
ms.custom:
7
7
- build-2024
8
8
ms.topic: how-to
9
-
ms.date: 12/13/2024
9
+
ms.date: 01/13/2025
10
10
ms.author: danlep
11
11
ms.collection: ce-skilling-ai-copilot
12
12
---
@@ -27,10 +27,10 @@ Enable semantic caching of responses to Azure OpenAI API requests to reduce band
27
27
* Chat Completion API (or Completion API) - Deployment used for API consumer calls
28
28
* Embeddings API - Deployment used for semantic caching
29
29
* The API Management instance must be configured to use managed identity authentication to the Azure OpenAI APIs. For more information, see [Authenticate and authorize access to Azure OpenAI APIs using Azure API Management ](api-management-authenticate-authorize-azure-openai.md#authenticate-with-managed-identity).
30
-
*[Azure Cache for Redis Enterprise](../azure-cache-for-redis/quickstart-create-redis-enterprise.md). The **RediSearch** module must be enabled on the Redis Enterprise cache.
30
+
*An [Azure Cache for Redis Enterprise](../azure-cache-for-redis/quickstart-create-redis-enterprise.md) or [Azure Managed Redis](../azure-cache-for-redis/quickstart-create-managed-redis.md) instance. The **RediSearch** module must be enabled on the Redis cache.
31
31
> [!NOTE]
32
-
> You can only enable the **RediSearch** module when creating a new Redis Enterprise cache. You can't add a module to an existing cache. [Learn more](../azure-cache-for-redis/cache-redis-modules.md)
33
-
* External cache configured in the Azure API Management instance. For steps, see [Use an external Azure Cache for Redis in Azure API Management](api-management-howto-cache-external.md).
32
+
> You can only enable the **RediSearch** module when creating a new Azure Redis Enterprise or Azure Managed Redis cache. You can't add a module to an existing cache. [Learn more](../azure-cache-for-redis/cache-redis-modules.md)
33
+
* External cache configured in the Azure API Management instance. For steps, see [Use an external Redis-compatible cache in Azure API Management](api-management-howto-cache-external.md).
0 commit comments