Facing issue with Lookup Cache miss

Hi Greetings,

I'm trying to implement caching with apigee provided policies (populate and lookup cache) and stucked with one peculiar issue with lookup-cache.

Say for example, my first api request is working as expected but from the second/third api-request I start to getting this `cache-hit: false` issue. But, if I resend/refresh the UI, it gets me the expected data from cache.

Here is my populate-cache policy in 'getUserInfo' proxy attached to ProxyEndpoint:

<populatecache async="false" continueonerror="false" enabled="true" name="PC-StoreUserInfo">
	<displayname>PC-StoreUserInfo</displayname>
	<properties></properties>
	<cachekey>
		<prefix>user_info</prefix>
		<keyfragment ref="app_enduser"></keyfragment>
	</cachekey>
	<scope>Exclusive</scope>
	<expirysettings>
		<timeoutinseconds>3600</timeoutinseconds>
	</expirysettings>
	<source>response.content</Source>
</populatecache>

and here is my Lookup cache policy from 'sampleSharedFlow' Sharedflow:

<lookupcache async="false" continueonerror="false" enabled="true" name="LC-GetUserInfoFromCache">
	<displayname>LC-GetUserInfoFromCache</displayname>
	<properties></properties>
	<cachekey>
		<prefix>user_info</prefix>
		<keyfragment ref="app_enduser"></keyfragment>
	</cachekey>
	<scope>Exclusive</scope>
	<assignto>userDetail</assignto>
</lookupcache>

(sorry can't share the trace session):

type LookupCacheExecution
enforcement request
stepDefinition-continueOnError false
stepDefinition-displayName LC-GetUserInfoFromCache
stepDefinition-name LC-GetUserInfoFromCache
stepDefinition-enabled true
result true
lookupcache.LC-GetUserInfoFromCache.failed false
lookupcache.LC-GetUserInfoFromCache.fault.name
lookupcache.LC-GetUserInfoFromCache.assignto userDetail
lookupcache.LC-GetUserInfoFromCache.isEncrypted false
lookupcache.LC-GetUserInfoFromCache.cachekey user_info__ttyu@yopmail.com
lookupcache.LC-GetUserInfoFromCache.cachename example__dev
lookupcache.LC-GetUserInfoFromCache.cachehit false
lookupcache.LC-GetUserInfoFromCache.fault.cause

What might be the possible cause of this cachehit false? where on reload/resend of the same request it gets the desired data from cache.

Thanks

0 2 417
2 REPLIES 2

Can you check this answer and see if this is your experience?

The short summary is that it's possible you're seeing a bug in the Trace/DebugSession capability. And in fact the result of the LookupCache is a success, not a failure, but the trace shows it as a failure (cachehit = false).

In which case the resolution is ... ignore or work-around the Trace bug, and just keep going with your API Proxy development.

Hi @Dino-at-Google,

First of all thanks for your time.

As per that link and your short description on the same "result of the LookupCache is a success, not a failure, but the trace shows it as a failure".

Does that mean my '<assignto>userDetail</assignto>' tag will store the resulting data into 'userDetail'?
What is the expected outcome of this variable incase of these scenario?

Because down the line i'm using JS-policy to manipulate this variable (where i expect this userDetail tobe always present) and make a api-call and i don't get any value in 'userDetail' variable.


Thanks