CacheConfig class
Cache configuration for a single ApiExecutor.execute call.
Example:
final result = await ApiExecutor.execute<List<Gallery>>(
request: () => dio.get('/galleries'),
parser: (json) => (json as List).map(Gallery.fromJson).toList(),
cache: CacheConfig(
policy: CachePolicy.networkFirst,
key: 'user_galleries',
duration: Duration(minutes: 5),
),
);
Constructors
- CacheConfig({required String key, required Duration duration, CachePolicy policy = CachePolicy.networkFirst})
-
const
Properties
- duration → Duration
-
How long the cached value is considered fresh
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → String
-
Cache key (required – must be unique per logical resource)
final
- policy → CachePolicy
-
Which policy to use (default: CachePolicy.networkFirst)
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited