用于 Android 和 Java 的响应式缓存库 RxCache

码农软件 · 软件分类 · 缓存系统 · 2019-08-29 15:28:38

软件介绍

RxCache 是一个用于 Android 和 Java 的响应式缓存库,可将缓存需求转换为一个接口进行配置。

RxCache 的灵感来源于 Retrofit ,目标是像 Picasso 缓存图片一样,毫不费力缓存数据对象。

当提供一个 observable、 single、 maybe 或 flowable 这些由耗时操作提供的数据时,RxCache 会确定是否需要 subscribe ,或覆盖先前缓存的数据。此决定是基于 RxCache 的 Providers 进行配置的。

架构图:


Usage

使用尽可能多的方法定义 interface 来创建 Provider 以缓存数据:

interface Providers {

        @ProviderKey("mocks")
        Observable<List<Mock>> getMocks(Observable<List<Mock>> oMocks);
    
        @ProviderKey("mocks-5-minute-ttl")
        @LifeCache(duration = 5, timeUnit = TimeUnit.MINUTES)
        Observable<List<Mock>> getMocksWith5MinutesLifeTime(Observable<List<Mock>> oMocks);
    
        @ProviderKey("mocks-evict-provider")
        Observable<List<Mock>> getMocksEvictProvider(Observable<List<Mock>> oMocks, EvictProvider evictProvider);
    
        @ProviderKey("mocks-paginate")
        Observable<List<Mock>> getMocksPaginate(Observable<List<Mock>> oMocks, DynamicKey page);
    
        @ProviderKey("mocks-paginate-evict-per-page")
        Observable<List<Mock>> getMocksPaginateEvictingPerPage(Observable<List<Mock>> oMocks, DynamicKey page, EvictDynamicKey evictPage);
        
        @ProviderKey("mocks-paginate-evict-per-filter")
        Observable<List<Mock>> getMocksPaginateWithFiltersEvictingPerFilter(Observable<List<Mock>> oMocks, DynamicKeyGroup filterPage, EvictDynamicKey evictFilter);
}

本文地址:https://www.codercto.com/soft/d/13434.html

C++Primer Plus

C++Primer Plus

Stephen Prata、孙建春、韦强 / 孙建春、韦强 / 人民邮电出版社 / 2005-5 / 72.00元

C++ Primer Plus(第五版)中文版,ISBN:9787115134165,作者:(美)Stephen Prata著;孙建春,韦强译一起来看看 《C++Primer Plus》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具