@@ -257,10 +257,9 @@ function $HttpProvider() {
257257 *
258258 * Object containing default values for all {@link ng.$http $http} requests.
259259 *
260- * - **`defaults.cache`** - {Object} - an object built with {@link ng.$cacheFactory `$cacheFactory`}
261- * that will provide the cache for all requests who set their `cache` property to `true`.
262- * If you set the `defaults.cache = false` then only requests that specify their own custom
263- * cache object will be cached. See {@link $http#caching $http Caching} for more information.
260+ * - **`defaults.cache`** - {boolean|Object} - A boolean value or object created with
261+ * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses
262+ * by default. See {@link $http#caching $http Caching} for more information.
264263 *
265264 * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
266265 * Defaults value is `'XSRF-TOKEN'`.
@@ -608,26 +607,35 @@ function $HttpProvider() {
608607 *
609608 * ## Caching
610609 *
611- * To enable caching, set the request configuration `cache` property to `true` (to use default
612- * cache) or to a custom cache object (built with {@link ng.$cacheFactory `$cacheFactory`}).
613- * When the cache is enabled, `$http` stores the response from the server in the specified
614- * cache. The next time the same request is made, the response is served from the cache without
615- * sending a request to the server.
610+ * {@link ng.$http `$http`} responses are not cached by default. To enable caching, you must
611+ * set the config.cache value or the default cache value to TRUE or to a cache object (created
612+ * with {@link ng.$cacheFactory `$cacheFactory`}). If defined, the value of config.cache takes
613+ * precedence over the default cache value.
616614 *
617- * Note that even if the response is served from cache, delivery of the data is asynchronous in
618- * the same way that real requests are.
615+ * In order to:
616+ * * cache all responses - set the default cache value to TRUE or to a cache object
617+ * * cache a specific response - set config.cache value to TRUE or to a cache object
619618 *
620- * If there are multiple GET requests for the same URL that should be cached using the same
621- * cache, but the cache is not populated yet, only one request to the server will be made and
622- * the remaining requests will be fulfilled using the response from the first request.
619+ * If caching is enabled, but neither the default cache nor config.cache are set to a cache object,
620+ * then the default `$cacheFactory($http)` object is used.
623621 *
624- * You can change the default cache to a new object (built with
625- * {@link ng.$cacheFactory `$cacheFactory`}) by updating the
626- * {@link ng.$http#defaults `$http.defaults.cache`} property. All requests who set
627- * their `cache` property to `true` will now use this cache object.
622+ * The default cache value can be set by updating the
623+ * {@link ng.$http#defaults `$http.defaults.cache`} property or the
624+ * {@link $httpProvider#defaults `$httpProvider.defaults.cache`} property.
625+ *
626+ * When caching is enabled, {@link ng.$http `$http`} stores the response from the server using
627+ * the relevant cache object. The next time the same request is made, the response is returned
628+ * from the cache without sending a request to the server.
629+ *
630+ * Take note that:
631+ *
632+ * * Only GET and JSONP requests are cached.
633+ * * The cache key is the request URL including search parameters; headers are not considered.
634+ * * Cached responses are returned asynchronously, in the same way as responses from the server.
635+ * * If multiple identical requests are made using the same cache, which is not yet populated,
636+ * one request will be made to the server and remaining requests will return the same response.
637+ * * A cache-control header on the response does not affect if or how responses are cached.
628638 *
629- * If you set the default cache to `false` then only requests that specify their own custom
630- * cache object will be cached.
631639 *
632640 * ## Interceptors
633641 *
@@ -805,10 +813,9 @@ function $HttpProvider() {
805813 * by registering it as a {@link auto.$provide#service service}.
806814 * The default serializer is the {@link $httpParamSerializer $httpParamSerializer};
807815 * alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike}
808- * - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
809- * GET request, otherwise if a cache instance built with
810- * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
811- * caching.
816+ * - **cache** – `{boolean|Object}` – A boolean value or object created with
817+ * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of the HTTP response.
818+ * See {@link $http#caching $http Caching} for more information.
812819 * - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}
813820 * that should abort the request when resolved.
814821 * - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the
0 commit comments