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

$http cache docs are not clear #11101

Closed
Closed
@Fonger

Description

@Fonger

According to the docs,
it says

To enable caching, set the request configuration cache property to true (to use default cache) or to a custom cache object (built with $cacheFactory)
You can change the default cache to a new object (built with $cacheFactory) by updating the $http.defaults.cache property. All requests who set their cache property to true will now use this cache object.
If you set the default cache to false then only requests that specify their own custom cache object will be cached.

I'm confused by the default value. The doc doesn't specify this.
So I run $http.defaults.cache and gets undefined. So will it ignore all cache-control header? It seems that this is not true.

I have the following question:

  1. If cache is true, it will follow the http cache-control header and store the cache in browser cache. Is this correct? If it's true but the server doesn't reply cache-control header, it won't cache.
  2. If cache is false it won't cache even if the server reply cache-control header.
  3. If it's a CacheFactory object, then the object will handle it. Also ignore the cache-control header.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions