Android中简单轻量级的数据缓存类库DCache
16lz
2021-01-26
DCache
一个简单,轻量级的数据缓存类库!
github地址:https://github.com/li-xiaojun/DCache
Features
- 使用简单,并且可配置缓存目录,缓存周期,并支持为单个数据设置独立的缓存周期
- 支持缓存数据类型:String字符串,Object,字节数组
Usage
- 配置DCache:
DCache.get(this).cacheDir(file).cacheDuration(1000*5);
- 缓存和获取字符串数据:
DCache.get(this).putString("test1", "一支穿云箭,千军万马来相见!");String data = DCache.get(MainActivity.this).getString("test1");
- 缓存和获取序列化对象数据:
DCache.get(this).putObject("Stu", new Stu("李晓俊", 25));Stu data = (Stu) DCache.get(MainActivity.this).getObject("Stu");
更多相关文章
- SpringBoot 2.0 中 HikariCP 数据库连接池原理解析
- 一句话锁定MySQL数据占用元凶
- 转:android:Adapter用法总结
- 14天学会安卓开发(第九天)ContentProvider与BroadcastReceiver
- Android(安卓)Camera数据流分析全程记录(overlay方式)
- Android-Universal-Image-Loader 源码解读
- Android面试基础题总结二
- Android(安卓)资源详解(一) 颜色、字符串、位图资源
- Android中string.xml,动态改变数据方法