title: Cache HttpClient objects with a custom critetia
body: <p>I'm working on an application where it uses Apache HttpClient objects to resolve HTTP and HTTPS requests (GET, POST ...). And I'm looking for a method to cache those HttpClient objects for reuse. And I should be able to define a caching criteria, <strong>in this case the caching should be based on the host name of the service request url</strong>.</p>
  
  <p>i.e. if I'm sending GET requests for a specific url (abc.net/content , abc.net/content2 ... ) then those requests should be handled through a single HttpClient object. And that HttpClient object should be kept in a cache so that It will be used for future request in similar manner.</p>
  
  <p>I'm referring to some resources and found <a href="https://github.com/otto-de/jsonhome/blob/master/jsonhome-client/src/main/java/de/otto/jsonhome/client/HttpJsonHomeClient.java" rel="nofollow noreferrer">this</a> and <a href="http://www.programcreek.com/java-api-examples/index.php?api=org.apache.http.client.cache.HttpCacheStorage" rel="nofollow noreferrer">this.</a> But no idea how to use them for the purpose.</p>
  
  <p>What should be the correct way to do this ? <strong>Can I do this using a HashMap&lt; String, HttpClient ></strong> ? Or is there a better way to do this using ApacheHttp ?</p>