Apigee Hybrid - Issue with Cache Lookup

Hi,

we're facing some issues when using Apigee Hybrid native caching solution.

In login API proxy "A", after user authentication, in response Proxy Endpoint pre-flow, we're populating a cache record specifying the userid as key and a sessionID as value. To do so, we're using this policy:

 

<PopulateCache continueOnError="false" enabled="true" name="Populate-Cache-userSESSION">
    <DisplayName>Populate Cache-userSESSION</DisplayName>
    <Properties/>
    <CacheKey>
        <KeyFragment ref="username"/>
    </CacheKey>
    <CacheResource>SessionUserCache</CacheResource>
    <Scope>Global</Scope>
    <ExpirySettings>
        <TimeoutInSec>21600</TimeoutInSec>
    </ExpirySettings>
    <Source>code</Source>
</PopulateCache>

 

To verify if the "PopulateCache" correctly succeeded, we use this LookupCache policy as last step in the same response flow:

 

<LookupCache continueOnError="false" enabled="true" name="Lookup-Cache-userSESSION">
    <DisplayName>Lookup Cache-userSESSION</DisplayName>
    <AssignTo>sessionID</AssignTo>
    <Scope>Global</Scope>
    <CacheKey>
        <KeyFragment ref="username"/>
    </CacheKey>
    <CacheResource>SessionUserCache</CacheResource>
</LookupCache>

 

These two policies seem to work fine, since we're getting the correct values retrieved in the response flow.

Actually, when we try to perform the same LookupCache policy inside another API proxy "B" (in Proxy Endpoint request pre-flow) we're facing some problems:

- sometimes the values are not retrieved (during some API proxy "B" debug sessions, we noticed that in this case the variable "message.cache.source" is "≠CACHE_MISS");

- sometimes the values are correctly retrieved only the first time, but then the following API calls face again the cache miss problem.

Appreciate your support @dchiesa1 

Thanks

0 1 221
1 REPLY 1

Sorry I missed this question when you originally posted it. You seem to have the configuration correct.  I don't have any insight as to why your cache would be behaving this way.  It's strange why you'd see a cache miss after a cache hit.  I suggest that you contact Apigee support to help diagnose this.  I guess you are using Apigee Edge? I think the caching has been reworked to be simpler in Apigee X.