java.net.ResponseCache
Represents implementations of URLConnection caches. An instance of such a class can be registered with the system by doing ResponseCache.setDefault(ResponseCache), and the system will call this object in order to:
1. store resource data that has been retrieved from an external source in the cache.
2. try to fetch a requested resource that may have been stored in the cache The
ResponseCache implementation decides which resources should be cached, and for how long they should be cached. If a request resource cannot be retrieved from the cache, then the protocol handlers will fetch the resource from its original location. The settings for URLConnection#useCaches control whether the protocol is allowed to use a cached response.
Some methods of ResponseCache class
get(URI, String, Map): This method retrieves the cached response based on the requested URI, the request method, and the request headers. Typically this method is called by the protocol handler before it sends out the request to get the network resource. If a cached response is returned, that resource is used instead.
ResponseCache.getDefault(): This method gets the system-wide response cache.
put(URI, URLConnection): The protocol handler calls this method after a resource has been retrieved, and the ResponseCache must decide whether or not to store the resource in its cache.
ResponseCache.setDefault(ResponseCache): This method sets (or unsets) the system-wide cache.
No comments:
Post a Comment