Android 数据持久化的方案

1.Android提供的存储方式:文件存储,nosql,sqlite数据库,

1 . 文件存储

1.SharePreferences:Android官方提供的缓存文件,以XML形式存储;

2.MMKV:https://github.com/tencent/mmkv。MMKV 是基于 mmap 内存映射的移动端通用 key-value 组件,底层序列化/反序列化使用 protobuf 实现,性能高,稳定性强。

3.ASimpleCache:https://github.com/yangfuhai/ASimpleCache。ASimpleCache 是一个为android制定的 轻量级的 开源缓存框架。轻量到只有一个java文件(由十几个类精简而来)。

2.基于sqlite 的封装

1.sqlite:Android 官方提供的嵌入式数据库

2.greenDAO(Google Room):https://github.com/greenrobot/greenDAO  基于SQLite的轻量级ORM  

3.nosql系列的数据库

1.Realm:https://realm.io/cn/docs/

2.objectbox :https://github.com/objectbox

猜你喜欢

转载自blog.csdn.net/MatrixMind/article/details/87862368