Caching of value is shared between two proxies

benyuen-1
Participant II

Hi,

I've a shared flow where im doing caching. Now when the shared flow is used in two different proxies but in the same environment it seems like they're sharing the cached value. I've scoped the caching as being Exclusive as in the doc because it gives the least namespace collison of cache keys. But is it inteded that they should share the same cache?

The name of the proxies are not equal.

The environment where the collision of the cached value is the same.

The CacheKey of the cached value is the same.

The LookupCache looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LookupCache async="false" continueOnError="false" enabled="true" name="SecretLookupCache">
    <DisplayName>SecretLookupCache</DisplayName>
    <Properties/>
    <CacheKey>
        <Prefix>KeyVault</Prefix>
        <KeyFragment>secret</KeyFragment>
        <KeyFragment ref="secretName"/>
    </CacheKey>
    <Scope>Exclusive</Scope>
    <AssignTo>secret</AssignTo>
</LookupCache>

PopulateCache:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PopulateCache async="false" continueOnError="false" enabled="true" name="SecretPopulateCache">
    <DisplayName>SecretPopulateCache</DisplayName>
    <Properties/>
    <CacheKey>
        <Prefix>KeyVault</Prefix>
        <KeyFragment>secret</KeyFragment>
        <KeyFragment ref="secretName"/>
    </CacheKey>
    <Scope>Exclusive</Scope>
    <ExpirySettings>
        <TimeoutInSec>300</TimeoutInSec>
    </ExpirySettings>
    <Source>secret</Source>
</PopulateCache>
Solved Solved
0 2 337
1 ACCEPTED SOLUTION

According to cache documentation [1]

If a <Prefix> element is present in <CacheKey>, it supercedes a <Scope> element value.

Hence in your proxies, you need to remove <Prefix>, keep only Scope Exclusive to avoid cache collision between 2 proxies.

[1] https://docs.apigee.com/api-platform/cache/caching-edge

View solution in original post

2 REPLIES 2

According to cache documentation [1]

If a <Prefix> element is present in <CacheKey>, it supercedes a <Scope> element value.

Hence in your proxies, you need to remove <Prefix>, keep only Scope Exclusive to avoid cache collision between 2 proxies.

[1] https://docs.apigee.com/api-platform/cache/caching-edge

Thanks!!!!!