Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Invalidating cache programmatically with partial cache key

I have developed an application that displays a large volume of records and have implemented response caching in the API using Apigee. The cache key is based on the request URI and the idToken of the logged-in user to make the cache user-specific. However, if an admin changes the role or access privileges for another user, I need to implement an API that can invalidate the cache for that specific user. The challenge is that I cannot obtain the idToken for the other user. Is there an alternative approach to achieve this?


Also, how can I get the cache_name is there any documentation for that. If not, can you please any screenshots to get the cache_name for better understanding.

I have cache policy something similar to below

<ResponseCache continueOnError="false" enabled="true" name="RC-All">
        <DisplayName>RC-All</DisplayName>
        <CacheKey>
              <Prefix/>
              <KeyFragment ref="request.uri" type="string"/>
              <KeyFragment ref="idToken"/>
         </CacheKey>
        <Scope>Exclusive</Scope>
        <ExpirySettings>
                <ExpiryDate/>
                <TimeOfDay/>
                <TimeoutInSeconds ref="">3600</TimeoutInSeconds>
         </ExpirySettings>
         <SkipCacheLookup/>
         <SkipCachePopulation/>
</ResponseCache>


I’m considering adding a <CacheResource> tag to explicitly define a cache name. For example:


<CacheResource>My-cache-check</CacheResource>

  • If I add this tag, will the cache name be My-cache-check?
  • Is it mandatory to include the <CacheResource> tag to specify the cache name for deleting cache entries?
0 3 1,439
3 REPLIES 3