none
Availability of SDK in C# for removing cache with Azure API Management RRS feed

All replies

  • You can make use of Azure REST API for Cache - Delete.

    Cache - Delete : Deletes specific Cache

    DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}?api-version=2019-01-01

    Wednesday, July 17, 2019 3:45 AM
    Moderator
  • @DixitArora-MSFT

    Where can I find out the CacheId? It is not a cache key?

    Wednesday, July 17, 2019 7:49 AM
  • I have check this internally with Product group and at present there is an indirect way to reset cache by changing policy, this will force APIM to rotate cache keys and effectively invalidate cache. This will invalidate both cache entries created by cache-store/lookup and cache-store/lookup-value policies.

    Alternative approach is to create an API in APIM without any backend and use cache-remove-value to clear cache, and call the API whenever you need. But this only allows you to remove entries added with cache-store-value.


    Thursday, July 18, 2019 8:43 AM
    Moderator
  • I have check this internally with Product group and at present there is an indirect way to reset cache by changing policy, this will force APIM to rotate cache keys and effectively invalidate cache. This will invalidate both cache entries created by cache-store/lookup and cache-store/lookup-value policies.

    Alternative approach is to create an API in APIM without any backend and use cache-remove-value to clear cache, and call the API whenever you need. But this only allows you to remove entries added with cache-store-value.


      I knew both approaches.

    I have a question on the first one: How to reset cache programmatically? I know I can change policy via portal.

    The second approach: This requires protection against the link, which requires more work on security.

    On the Rest API approach you provided:

    Do you know what CacheId is?

    DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}?api-version=2019-01-01

    Thursday, July 18, 2019 9:13 AM