Caching in Java Callout Policy

Can I maintain in memory cache in Java Callout Policy jar file?

I am not sure how is this jar maintained at runtime. This must be part of some runtime env thus should have the ability to manage in memory cache, and the cache will last until proxy instance restarts or scales. Is this understanding correct?

@dchiesa1 @ssvaidyanathan @sgilson 

2 REPLIES 2

Not sure if we are clear on the question. You can implement cache with in java callout. Once you implement & deploy the required artifacts gets loaded to MP in below path & if you implemented it properly the caching should work as expected.

/opt/apigee/var/log/edge-message-processor/work/o/{orgname}/e/{envname}/a

@shubham90 - am not clear what is needed either. What are you trying to cache? Is it something that gets passed to the callout or something available as a flow variable? Typically it implements the ExecutionContext interface and the runtime calls that as part of the policy execution. If you have your Java code to use static objects or Singletons, then they get created during the proxy deployment and then evicted when you restart or redeploy. If you want to use it for Caching, I would recommend using the combination of Java callouts and the out of the box Caching policies.