flutter 设置缓存的方法

Dart 复制代码
final prefs = await SharedPreferences.getInstance();
  1. 设置缓存
Dart 复制代码
prefs.setString(key, data);

2.读取缓存

Dart 复制代码
prefs.getString(key)

3.清除缓存

Dart 复制代码
prefs.remove(key);

其中 key 是要钥匙 data 是要处理的值,这里是字符串

相关推荐
code2cat5 小时前
【随笔】推理准入控制:请求进来之前,先给KV缓存留出位置
缓存·大语言模型·vllm
徐小黑ACG8 小时前
Redis-基础
数据库·redis·缓存
恋猫de小郭12 小时前
Flutter 下 AOT 一个你怎么都想不出来的 Bug ,JIT 正常的计算,在 AOT 居然算错了
android·前端·flutter
好的佩奇1 天前
Dart 之扩展方法
android·flutter·dart
FungLeo1 天前
成为全栈·基础补充·缓存的层次与失效:浏览器、CDN、服务端、数据库
缓存·cdn·数据一致性·http缓存·成为全栈·flutter缓存
好的佩奇1 天前
蓝牙之经典蓝牙
android·flutter·蓝牙
传奇开心果编程1 天前
【Flutter踩坑排雷】第19课:路由硬编码坑|字符串路由书写错误,页面跳转失败排查
android·flutter·ios·移动开发·跨平台·ui框架·声明式ui
code2cat1 天前
【随笔】KV缓存量化:省下的显存,要付出多少数值误差
人工智能·缓存·大语言模型
csdn_aspnet1 天前
Redis 入门:Windows、Mac安装指南
数据库·windows·redis·缓存·mac
Pniubi2 天前
缓存击穿的解决方案
缓存