API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  How to clear cache key used in invoke policy

    Posted Fri November 22, 2024 12:17 PM

    Hello,

    I was wondering if there's a way to reset or remove a cache key and its content used in a invoke policy.

    We want to do this because when we make an oauth call to get a token from an oauth provider, we'd like to cache the token using a cache key in the invoke policy.

    But in the case that if there's anything wrong with this token (an error is thrown in the subsequent call using this bearer token), we'd like to clear the cache for this cache key so that the next time when a request is made, APIC will attempt to get a new token instead of keep using the cached token until the ttl expires.

    In other words, we want to cache the token, and if the token works, we want to use it till ttl expires; but if it doesn't, then we want to get a token each time (no more caching).

    Any help or suggestion on this is greatly appreciated.

    Thank you,

    Jack



    ------------------------------
    Jack Shih
    ------------------------------


  • 2.  RE: How to clear cache key used in invoke policy

    Posted Mon November 25, 2024 01:46 PM

    Hi Jack,
    You can clear a response from the document cache programmatically.  Assuming you're using the v10 API Connect Gateway, see https://www.ibm.com/docs/en/datapower-gateway/10.5.0?topic=functions-apigwflush-apigw-documents where you'd need to provide as arguments the cachekey as the uri of the cached entry.
    Best Regards,
    Steve Linn



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------