How do I invalidate cache by InvalidateCache policy?

Not applicable

Hi all, I've reached a problem building my API proxy. For GET method I lookup for data in cache by LookupCache policy (if it's not there i populate it by PopulateCache policy) and for DELETE method I purge it by InvalidateCache policy. Unfortunatelly this cache entry is not cleared at all and GET method sees the old data. Please help. Bellow I attached policies XMLs:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LookupCache async="false" continueOnError="false" enabled="true" name="Lookup-Cache-For-Messages">
  <DisplayName>Lookup Cache For Messages</DisplayName>
  <Properties/>
  <CacheKey>
  <Prefix/>
  <KeyFragment>os</KeyFragment>
  <KeyFragment ref="verifyapikey.verify-api-key.brand"/>
  <KeyFragment ref="verifyapikey.verify-api-key.locale"/>
  <KeyFragment ref="accesstoken.username"/>
  <KeyFragment>getMessage</KeyFragment>
  </CacheKey>
  <Scope>Exclusive</Scope>
  <CacheResource>OwnerServices</CacheResource>
  <AssignTo>getMessage</AssignTo>
</LookupCache>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PopulateCache async="false" continueOnError="false" enabled="true" name="Populate-Cache-For-Messages">
  <DisplayName>Populate Cache For Messages</DisplayName>
  <Properties/>
  <CacheKey>
  <Prefix/>
  <KeyFragment>os</KeyFragment>
  <KeyFragment ref="verifyapikey.verify-api-key.brand"/>
  <KeyFragment ref="verifyapikey.verify-api-key.locale"/>
  <KeyFragment ref="accesstoken.username"/>
  <KeyFragment>getMessage</KeyFragment>
  </CacheKey>
  <Scope>Exclusive</Scope>
  <CacheResource>OwnerServices</CacheResource>
  <Source>getMessageResponse.content</Source>
</PopulateCache>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<InvalidateCache async="false" continueOnError="false" enabled="false" name="Invalidate-Cache-For-Messages">
  <DisplayName>Invalidate Cache For Messages</DisplayName>
  <Properties/>
  <CacheKey>
  <Prefix/>
  <KeyFragment>os</KeyFragment>
  <KeyFragment ref="verifyapikey.verify-api-key.brand"/>
  <KeyFragment ref="verifyapikey.verify-api-key.locale"/>
  <KeyFragment ref="accesstoken.username"/>
  <KeyFragment>getMessage</KeyFragment>
  </CacheKey>
  <CacheResource>OwnerServices</CacheResource>
  <Scope>Exclusive</Scope>
  <CacheContext>
  <APIProxyName>Some string</APIProxyName>
  <ProxyName>Some string</ProxyName>
  <TargetName>Some string</TargetName>
  </CacheContext>
  <PurgeChildEntries>false</PurgeChildEntries>
</InvalidateCache>
0 2 662
2 REPLIES 2

anilsr
Staff

@Michał Nita ,

Welcome to Apigee Community.

Just FYI, You can also use Code Button in rich text editor to prettify your code... I have done that for now 🙂

1140-code.png

0 1 0

Not applicable

OK, Thank you 🙂

0 0 0
Top Labels in this Space
Top Solution Authors