MemoryCacheHelper<Info> mixin
A mixin that provides simple in-memory caching capabilities to a Repository.
It manages a single cache entry of type Info, tracking the timestamp
and determining validity based on refreshDuration.
- Mixin applications
Properties
- cache ↔ Info?
-
Retrieves the cached data if available. Updates lastRetry.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- lastRetry ↔ DateTime?
-
The timestamp of the last attempt to access the cache.
getter/setter pair
- refreshDuration → Duration
-
The duration for which the cache is considered valid.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeStamp ↔ DateTime?
-
The timestamp when the cache was last updated.
getter/setter pair
Methods
-
clear(
) → void - Clears the cache and resets timestamps.
-
isCached(
) → bool -
Returns
trueif there is data in the cache (regardless of expiration). -
isRefreshRequired(
) → bool - Checks if the cache needs to be refreshed.
-
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