TCacheManager<T> class
A cache manager for managing cached items of type T.
It provides functionality to get, put, and delete cached items. It also manages the size of the cache and cleans up expired items.
Constructors
- TCacheManager({Duration? cleaningInterval, int? maxSize, String? debugLabel})
- Creates a new instance of TCacheManager.
Properties
- debugLabel → String?
-
A label to be used for debugging purposes.
final
- 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(
) → void - Clears the cache. Cancels any ongoing cleaning operations. Resets the current size to 0. Resets the cache to an empty state.
-
delete(
String key) → void - Deletes an item from the cache using its key.
-
deleteExpired(
) → void - Deletes all expired items from the cache.
-
dispose(
) → void - Disposes the cache manager, canceling any ongoing cleaning operations.
-
get(
String key) → T? - Retrieves an item from the cache using its key.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
String key, T value, {Duration ttl = const Duration(minutes: 1)}) → void - Inserts an item into the cache.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateCleaningInterval(
Duration newInterval) → void - Updates the cleaning interval for the cache.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited