eyf_cache 0.0.7 eyf_cache: ^0.0.7 copied to clipboard
flutter storage
flutter storage uages document #
1、 MMKV本地数据缓存
/// 保存int数据
/// [key] 存储key
/// [value] int value
MMKVStorage.instance.putInt({required String key, int value = 0})
/// 保存double数据
/// [key] 存储key
/// [value] double value
MMKVStorage.instance.putDouble({required String key, double value = 0.0})
/// 保存string数据
/// [key] 存储key
/// [value] string value
MMKVStorage.instance.putString({required String key, String value = ""})
/// 保存string数据
/// [key] 存储key
/// [value] string value
MMKVStorage.instance.putString({required String key, String value = ""})
/// 保存数据
/// [key] 存储key
/// [data] dynamic data
MMKVStorage.instance.put({required String key, dynamic data})
/// 获取int值
/// [key] 存储key
/// [part] 缓存区类型
MKVStorage.instance.getInt({required String key}):Future<int?>
/// 获取double值
/// [key] 存储key
/// [part] 缓存区类型
MKVStorage.instance.getDouble({required String key}):Future<double?>
/// 获取bool值
/// [key] 存储key
/// [part] 缓存区类型
MKVStorage.instance.getBool({required String key}):Future<bool?>
/// 获取string值
/// [key] 存储key
/// [part] 缓存区类型
MKVStorage.instance.getString({required String key}):Future<String?>
/// 获取存储对象
/// [key] 存储key
MKVStorage.instance.getEntity<T>({required String key}):Future<T?>
/// 获取存储列表
/// [key] 存储key
MKVStorage.instance.getList<T>({required String key}):Future<T?>
/// 清除key对应缓存数据
/// [key] 存储key
MKVStorage.instance.remove({required String key})
2、特定时间内的数据缓存
/// 缓存有效数据
/// [cacheKey] 缓存key
/// [value] 缓存数据
/// [duration] 缓存时间
EffectiveStorage.instance.putString(
{required String cacheKey,
required String value,
Duration duration = const Duration()})
/// 清除缓存
/// [cacheKey] 缓存key
EffectiveStorage.instance.clean({required String cacheKey})
/// 获取有效数据
/// [cacheKey] 缓存key
EffectiveStorage.instance.getString({required String cacheKey}):Future<String>