Question about Shared Cache using Global as scope

Not applicable

Hi, im having problems using the scope Global and Shared Cache. I have two api proxies, that should do:

1. The first proxy should write into the cache (populate cache policy)

2. the second proxy should look into that cache and get the value that is cached (lookup cache policy)

The populate cache policy

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PopulateCache async="false" continueOnError="false" enabled="true" name="PopulateCacheSaveVar">
    <DisplayName>PopulateCache.SaveVar</DisplayName>
    <CacheKey>
        <KeyFragment>apiAccessToken</KeyFragment>
        <KeyFragment ref="responseVar"/>
    </CacheKey>
    <Scope>Global</Scope>
    <ExpirySettings>
        <TimeoutInSec>2600</TimeoutInSec>
    </ExpirySettings>
    <Source>sourceVar</Source>
</PopulateCache>

the look up cache policy

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LookupCache async="false" continueOnError="false" enabled="true" name="LookupCacheFindCache">
    <DisplayName>LookupCache.FindCache</DisplayName>
    <CacheKey>
        <KeyFragment>apiAccessToken</KeyFragment>
        <KeyFragment ref="someVar"/>
    </CacheKey>
    <Scope>Global</Scope>
    <AssignTo>CacheVar</AssignTo>
</LookupCache>

but it seems that when using CacheVar, its always null/empty string. Do someone have an idea or at least a working sample of two api's sharing a Global Internal Cache?

0 1 472
1 REPLY 1

Not applicable

Hi @Hanzel Garcia

As per the populate & lookup policies mentioned here, the cache key will be something like below,

orgname__env____apiAccessToken__{responseVar}

orgname__env____apiAccessToken__{someVar}

If the variable value of responseVar & someVar are same, only then you are referring to the same cache key.

To confirm if your lookup is hitting right cache key entry, you can try clear the cache if it exists using the below api.

http://apigee.com/docs/management/apis/post/organi...