DisabledCachePolicy class
A cache policy decorator that completely disables caching.
When active, isValid always returns false, forcing all repositories to fetch fresh data. markFresh and invalidate are no-ops.
This is useful for debug mode or when a remote config flag disables cache.
Example
// Wrap any policy to disable it
final policy = DisabledCachePolicy(DailyCachePolicy(...));
// Or use standalone
final policy = DisabledCachePolicy();
- Implemented types
Constructors
- DisabledCachePolicy([CachePolicy? inner])
- Creates a disabled cache policy.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → Future< void> -
Clear all cached data.
override
-
invalidate(
String key) → Future< void> -
Invalidate cached data for
key.override -
isValid(
String key) → Future< bool> -
Check if cached data for
keyis still valid.override -
markFresh(
String key) → Future< void> -
Mark cached data for
keyas fresh.override -
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