CacheManager class
Manages in-memory and persistent caching with TTL-based expiry.
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> - Clears all cached entries.
-
get(
String key) → dynamic -
Retrieves a cached value by key, or
nullif expired or missing. -
init(
) → Future< void> - Initializes the Hive cache box. Safe to call multiple times.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
String key) → void - Removes a single entry from the cache by key.
-
set(
String key, dynamic value, {Duration ttl = const Duration(minutes: 10)}) → void - Stores a value with an optional TTL (default 10 minutes).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → CacheManager
-
Singleton instance of CacheManager.
final