I have a similar problem as this issue from 2019 (https://www.googlecloudcommunity.com/gc/Apigee/Lookup-Cache-not-working-when-I-cache-the-data-using-...) but the responses on that thread are not showing a solution.
We have proxy A using ResponseCache policies and can successfully populate/lookup cached values.
Next, we have proxy B using LookupCache to retrieve the cached responses from the same cache used by proxy A. It is getting a 'cache hit=true' but the values dont make sense.
For troubleshooting, I added a javascript to get the flow variable set from the cacheLookup and print it to console, and the value we see are like :
com.apigee.messaging.adaptors.http.message.HttpResponseMessage@303d6cbc
Can the lookupCache policy be used to get cached responses that were added using responseCache policy?
Solved! Go to Solution.
Ok. I was under the impression that "responseCache" was effectively the same as doing PopulateCache/LookupCache policies but just a simplified way to define them.
Based on your reply, it sounds like we could replace the "ResponseCache" policies with "PopulateCache"/"LookupCache" policies in proxy A, and that should fix the problem.
The general idea of what we're doing is:
Proxy A gets client details from a backend server, the response is an encoded string.
Then many other proxies (i.e. "proxy B") can use a sharedFlow to set a header with that encoded string before requests go to their targetServers.
The idea was for the sharedFlow to check the cache first, and if found, great, it can set the header.
If not found in the cache, it does a service-callout to proxy A, and then it uses the SC response to set the header. Since proxy A also populates the cache, it will already be there for any subsequent requests.