CacheOptions class

Options to apply to handle request and cache behaviour.

Constructors

CacheOptions({CachePolicy policy = CachePolicy.request, List<int>? hitCacheOnErrorExcept, CacheKeyBuilder keyBuilder = defaultCacheKeyBuilder, Duration? maxStale, CachePriority priority = CachePriority.normal, CacheCipher? cipher, bool allowPostMethod = false, required CacheStore? store})
const

Properties

allowPostMethod bool
allow POST method request to be cached.
final
cipher → CacheCipher?
Optional method to decrypt/encrypt cache content
final
hashCode int
The hash code for this object.
no setterinherited
hitCacheOnErrorExcept List<int>?
Ability to return cache excepted on given status codes. Giving an empty list will hit cache on any status codes.
final
keyBuilder CacheKeyBuilder
Builds the unique key used for indexing a request in cache. Default to CacheOptions.defaultCacheKeyBuilder
final
maxStale Duration?
Overrides any HTTP directive to delete entry past this duration.
final
policy CachePolicy
Handles behaviour to request backend.
final
priority → CachePriority
The priority of a cached value. Ease the clean up if needed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
store → CacheStore?
Store used for caching data.
final

Methods

copyWith({CachePolicy? policy, Nullable<List<int>>? hitCacheOnErrorExcept, CacheKeyBuilder? keyBuilder, Nullable<Duration>? maxStale, CachePriority? priority, CacheStore? store, Nullable<CacheCipher>? cipher, bool? allowPostMethod}) CacheOptions
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toExtra() Map<String, dynamic>
toOptions() → Options
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

defaultCacheKeyBuilder(RequestOptions request) String
fromExtra(RequestOptions request) CacheOptions?