Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 717a670

Browse files
gentooboontoopetebacondarwin
authored andcommitted
docs($http): improve $http's caching documentation
Make the possibility to pass a custom cache instance to $http more obvious. Closes #4803
1 parent 37ac472 commit 717a670

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/ng/http.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,11 @@ function $HttpProvider() {
324324
*
325325
* # Caching
326326
*
327-
* To enable caching, set the configuration property `cache` to `true`. When the cache is
328-
* enabled, `$http` stores the response from the server in local cache. Next time the
329-
* response is served from the cache without sending a request to the server.
327+
* To enable caching, set the request configuration `cache` property to `true` (to use default
328+
* cache) or to a custom cache object (built with {@link ng.$cacheFactory `$cacheFactory`}).
329+
* When the cache is enabled, `$http` stores the response from the server in the specified
330+
* cache. The next time the same request is made, the response is served from the cache without
331+
* sending a request to the server.
330332
*
331333
* Note that even if the response is served from cache, delivery of the data is asynchronous in
332334
* the same way that real requests are.
@@ -335,9 +337,13 @@ function $HttpProvider() {
335337
* cache, but the cache is not populated yet, only one request to the server will be made and
336338
* the remaining requests will be fulfilled using the response from the first request.
337339
*
338-
* A custom default cache built with $cacheFactory can be provided in $http.defaults.cache.
339-
* To skip it, set configuration property `cache` to `false`.
340+
* You can change the default cache to a new object (built with
341+
* {@link ng.$cacheFactory `$cacheFactory`}) by updating the
342+
* {@link ng.$http#properties_defaults `$http.defaults.cache`} property. All requests who set
343+
* their `cache` property to `true` will now use this cache object.
340344
*
345+
* If you set the default cache to `false` then only requests that specify their own custom
346+
* cache object will be cached.
341347
*
342348
* # Interceptors
343349
*

0 commit comments

Comments
 (0)