Internal cache lookup and store value not working

Viewed 270

I am using Azure APIM Developer tier. I am trying to store a value in internal cache but it is not working.

Error message: No appropriate cache found for provided policy configuration. Policy execution will be skipped.

I understand that internal cache is available by default in APIM Developer tier. Does this message mean that it is not configured properly or there can be some other issue?

Policy (showing on cache related policies)

<!-- Check if partner info has already been cached for this subscription key and fetch it into a variable. -->
<cache-lookup-value key="@((string)context.Variables["subscriptionKey"])" variable-name="partnerInfo" caching-type="internal"/>
:
:
<set-variable name="partnerInfo" value="@{
            var partnerAccountNumber = context.Variables["partnerAccountNumber"];
            var partnerRegion = context.Variables["partnerRegion"];
            var partnerType = context.Variables["partnerType"];

            return $"{partnerAccountNumber}:{partnerRegion}:{partnerType}";
        }"/>

<cache-store-value caching-type="internal" key="@((string)context.Variables["id"])" value="@((string)context.Variables["partnerInfo"])" duration="10000"/>

Trace

{
    "source": "cache-lookup-value",
    "timestamp": "2022-03-10T21:58:24.6068604Z",
    "elapsed": "00:00:00.0005265",
    "data": "No appropriate cache found for provided policy configuration. Policy execution will be skipped."
},
{
    "source": "cache-lookup-value",
    "timestamp": "2022-03-10T21:58:24.6068650Z",
    "elapsed": "00:00:00.0005312",
    "data": {
        "message": "Cache lookup resulted in a miss, variable will not be set.",
        "key": "2_7c486765553047aca4f1088c0e5b1b8e",
        "variableName": "partnerInfo"
        }
}
:
:
:
{
    "source": "set-variable",
    "timestamp": "2022-03-10T21:58:25.2051048Z",
    "elapsed": "00:00:00.5987711",
    "data": {
        "message": "Context variable was successfully set.",
        "name": "partnerInfo",
        "value": "674756756:EMEA:CUSTOMER"
        }
},
{
    "source": "cache-store-value",
    "timestamp": "2022-03-10T21:58:25.2051357Z",
    "elapsed": "00:00:00.5988023",
    "data": "No appropriate cache found for provided policy configuration. Policy execution will be skipped."
}
1 Answers

I just remembered that we're using self-hosted gateways. As per documentation, built-in caching is not available for this type of setup and one should use external caching mechanism.

Related