CacheManager class

缓存管理器 - 统一管理缓存

Constructors

CacheManager()

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

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

Static Methods

cleanExpired() Future<int>
清理过期缓存
cleanIfOverLimit() Future<void>
清理超限缓存
clear() Future<void>
清空所有缓存
delete(String key) Future<void>
删除指定缓存
get<T>(String key, T fromJson(Map<String, dynamic>)) Future<T?>
获取缓存
getStats() Future<CacheStats>
获取统计信息
initialize({CacheStrategyType strategyType = CacheStrategyType.memory, bool enableAutoClean = true, Duration autoCleanInterval = const Duration(hours: 1), int maxCacheSizeMB = 100}) Future<void>
初始化
set<T>(String key, T data, {Duration? expiration, int priority = 5}) Future<void>
保存缓存