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