fWX228941 / project

all by myself
1 stars 0 forks source link

数据存储 #28

Open fWX228941 opened 5 years ago

fWX228941 commented 5 years ago

Store 1.简介 高效,响应式的数据加载A Java library for effortless, reactive data loading.

问题: 1.1.现在的软件模型,数据流畅性和可用性, 1.2.用户体验,在线或离线状态下,无缝连接,Users expect their UI experience to never be compromised (blocked) by new data loads.a seamless experience both online and offline. 1.3.漫游费用少,低流量,International users expect minimal data downloads as many megabytes of downloaded data can quickly result in astronomical phone bills.

模型: 1)索取,解析,存储 fetching, parsing, storage, and retrieval of data in your application. 2)配合RxJava事件监听和事件响应,单向数据流, adheres to a unidirectional data flow.

2.概述 请求数据,可以是通过网络,也可以是其他任何方式,缓存机制提供了内存或者磁盘模型,Defines how data will be fetched over network. You can also define how your Store will cache data in-memory and on-disk, as well as how to parse it. By utilizing Store, you eliminate the possibility of flooding your network with the same request while adding two layers of caching (memory and disk).

3.用法 3.1.Store 使用Builder 模式来创建,利用key-value 的方式来标识索取的数据,Stores use generic keys as identifiers for data. A key can be any value object that properly implements toString(), equals() and hashCode(). When your Fetcher function is called, it will be passed a particular Key value. Similarly, the key will be used as a primary identifier within caches 3.2.内存模型

the response will be stored in an in-memory cache.All subsequent calls to store.get(barCode) with the same Key will retrieve the cached version of the data, minimizing unnecessary data calls. minimizing unnecessarily waste bandwidth and battery. 存储的时间策略,默认情况是100条数据保存24小时 By default, 100 items will be cached in memory for 24 hours. You may pass in your own instance of a Guava Cache to override the default policy.

3.3.及时模型

https://github.com/NYTimes/Store

fWX228941 commented 5 years ago

Tray开源分析报告 1.背景 原生的sharedPrefernce 是不支持多进程的,在Android 6.0(APT 23)之后同时废弃了MODE_MULTI_PROCESS 属性,因为在某些android版本上性能不稳定,并且不支持跨进程同步更新的机制。 2.特性 2.1.支持多进程 2.2.以键值对的方式存储数据 2.3.自动存储 2.4.统一的接口 2.5.删除 2.6.支持更新,版本升级 2.7.可定制化,可创建自己的preference模块,分组打包preference,使得不同的模块对应不同的preference 2.8.对比数据库,性能更好,the SharedPreferences do not access the disk for every read/write action which causes the multiprocess problem btw

3.改进之处 3.1.加密 3.2.路径 3.3.监听 3.4.非基本类型

4.类图 001

5.流程

网址 https://github.com/NYTimes/Store