RequestCache enum

The cache read-only property of the Request interface contains the cache mode of the request. It controls how the request will interact with the browser's HTTP cache.

Inheritance

Constructors

RequestCache(String value)
const
RequestCache.from(String value)
factory

Values

byDefault → const RequestCache

The browser looks for a matching request in its HTTP cache.

  • If there is a match and it is fresh, it will be returned from the cache.
  • If there is a match but it is stale, the browser will make a conditional request to the remote server. If the server indicates that the resource has not changed, it will be returned from the cache. Otherwise the resource will be downloaded from the server and the cache will be updated.
  • If there is no match, the browser will make a normal request, and will update the cache with the downloaded resource.
const RequestCache('default')
noStore → const RequestCache

The browser fetches the resource from the remote server without first looking in the cache, and will not update the cache with the downloaded resource.

const RequestCache('no-store')
reload → const RequestCache

The browser fetches the resource from the remote server without first looking in the cache, but then will update the cache with the downloaded resource.

const RequestCache('reload')
noCache → const RequestCache

The browser looks for a matching request in its HTTP cache.

  • If there is a match, fresh or stale, the browser will make a conditional request to the remote server. If the server indicates that the resource has not changed, it will be returned from the cache. Otherwise the resource will be downloaded from the server and the cache will be updated.
  • If there is no match, the browser will make a normal request, and will update the cache with the downloaded resource.
const RequestCache('no-cache')
forceCache → const RequestCache

The browser looks for a matching request in its HTTP cache.

  • If there is a match, fresh or stale, it will be returned from the cache.
  • If there is no match, the browser will make a normal request, and will update the cache with the downloaded resource.
const RequestCache('force-cache')
onlyIfCached → const RequestCache

The browser looks for a matching request in its HTTP cache.

  • If there is a match, fresh or stale, it will be returned from the cache.
  • If there is no match, the browser will respond with a 504 Gateway timeout status.

The onlyIfCached mode can only be used if the request's mode is RequestMode.sameOrigin. Cached redirects will be followed if the request's redirect property is RequestRedirect.follow and the redirects do not violate the RequestMode.sameOrigin mode.

const RequestCache('only-if-cached')

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value String
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<RequestCache>
A constant List of the values in this enum, in order of their declaration.