-
Notifications
You must be signed in to change notification settings - Fork 27.4k
docs($http): expand caching section to cover FAQ #13003
Conversation
* | ||
* * Only GET and JSONP requests are cached. | ||
* * The cache key is the request url including search parameters; headers are not considered. | ||
* * Cached responses are return asynchronously, in the same way as responses from the server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return --> returned
* | ||
* If you set the default cache to `false` then only requests that specify their own custom | ||
* cache object will be cached. | ||
* The default cache can also be set to `false`, which will mean that only requests that specify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence seems incorrect (from taking a quick look at the code).
@gkalpak, you are correct: a default cache value of false can be overridden by a cache config value of true as well as a custom cache object, so I will update. This means that rows 260-263 of the file (describing the defaults object) are also incorrect, so I will include a revision of these in my commit as well. There is also no mention of the effect of setting the default cache to true (it results in the $http cache being used when the config cache is undefined), so I will expand my comments to include this. I set up this plunk to test the various combinations. |
@ryanhart2 Did you ever update this PR? |
@Narretz Apologies, I didn't and had forgotten about it. I will have a look this weekend and try to get it done. |
Am 21.01.2016 um 15:04 schrieb Ryan Hart:
|
We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm. |
@ryanhart2 why did you close it? |
CLAs look good, thanks! |
1 similar comment
CLAs look good, thanks! |
@Narretz Just struggling to do the rebase... I think I am getting there! |
* GET request, otherwise if a cache instance built with | ||
* {@link ng.$cacheFactory $cacheFactory}, this cache will be used for | ||
* caching. | ||
* - **cache** – `{boolean|Object}` – A value to enable caching of the HTTP response. See |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it is still useful to mention that the value must be either boolean or a Cache
object created with $cacheFactory
.
I left a couple of comments (actually it's the same comment twice 😛 ). |
add note that cache keys are the url and search params (headers not considered) add note that cache-control header on response does not affect angular caching add note that $httpProvider.defaults.cache can be used to set cache default (in addition to $http.defaults.cache) revise explanation of how caching can be enabled using cache.config value and cache default value Fixes #11101
…lue must be either boolean or a Cache object created with $cacheFactory
Thanks @gkalpak. I agree, the revised version now reads better. Thanks for the hint on the rebase. I have pushed a new commit addressing your suggestions. Note that, on the same lines, I also updated the words "enable caching" to "enable or disable caching", given that the values could be |
Included changes: * Point out that only GET & JSONP requests are cached. * Explain that the URL+search params are used as cache keys (headers not considered). * Add note about cache-control headers on response not affecting Angular caching. * Mention `$httpProvider.defaults.cache` (in addition to `$http.defaults.cache`). * Clear up how `defaults.cache` and `config.cache` are taken into account for determining the caching behavior for each request. Fixes #11101 Closes #13003
Included changes: * Point out that only GET & JSONP requests are cached. * Explain that the URL+search params are used as cache keys (headers not considered). * Add note about cache-control headers on response not affecting Angular caching. * Mention `$httpProvider.defaults.cache` (in addition to `$http.defaults.cache`). * Clear up how `defaults.cache` and `config.cache` are taken into account for determining the caching behavior for each request. Fixes #11101 Closes #13003
Backported to |
Fixes #11101