On Fri, 2016-07-01 at 00:04 -0400, Donald Ball wrote: > Hi folks. I'm using the caching http client to nice effect, thanks for the > good work. > > Since parsing json and other structured response bodies is not actually the > fastest process in the world, I thought it would be a useful optimization > to build a parsed body cache atop the http caching client. I've written one > and it does work fine, but there is an annoying wrinkle: I don't know > whether or not a given response is cacheable except by observing from the > context's cache response if the response was in some way served from the > cache. This results in having to perform two parses on a given body before > it can be served from the parsed body cache. It's not the end of the world, > but it's not optimal. > > Is there some way that I have overlooked by which I can tell if a given > response is cacheable? > > I appreciate any thoughts. Thanks.
Have you looked at ResponseCachingPolicy? http://hc.apache.org/httpcomponents-client-4.5.x/httpclient-cache/xref/org/apache/http/impl/client/cache/ResponseCachingPolicy.html Its #isResponseCacheable method is likely what you want. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org