CacheManager class
A powerful cache manager for Flutter applications using Sembast NoSQL database.
Provides efficient caching with automatic expiration, batch operations, and comprehensive cache management features.
Constructors
- CacheManager()
- Creates a new instance of CacheManager.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isInitialized → bool
-
Checks if the cache manager has been initialized.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cleanExpired(
) → Future< int> - Removes all expired cache entries.
-
clearAllCache(
) → Future< void> - Clears all cached entries.
-
close(
) → Future< void> - Closes the database connection.
-
deleteBatch(
List< String> keys) → Future<void> - Deletes multiple cache entries at once.
-
deleteCache(
String key) → Future< void> - Deletes a specific cache entry by its key.
-
getAllKeys(
) → Future< List< String> > - Returns all cache keys.
-
getBatch(
List< String> keys) → Future<Map< String, dynamic> > - Retrieves multiple cache entries at once.
-
getCache(
String key) → Future - Retrieves a cached value by its key.
-
getCacheSize(
) → Future< int> - Returns the number of cached entries.
-
hasKey(
String key) → Future< bool> - Checks if a cache entry exists for the given key.
-
init(
) → Future< void> - Initializes the cache manager and opens the database connection.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setBatch(
Map< String, dynamic> entries, {Duration duration = const Duration(hours: 1)}) → Future<void> - Sets multiple cache entries at once.
-
setCache(
String key, dynamic value, {Duration duration = const Duration(hours: 1)}) → Future< void> - Stores a value in the cache with an optional expiration duration.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited