This repository was archived by the owner on Apr 13, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 3232* ** RxJava 2.0**
3333``` groovy
3434dependencies {
35- compile 'com.zchu:rxcache:2.0.1 '
35+ compile 'com.zchu:rxcache:2.0.2 '
3636}
3737```
3838* ** RxJava 1.0**
3939``` groovy
4040dependencies {
41- compile 'com.zchu:rxcache:1.2.1 '
41+ compile 'com.zchu:rxcache:1.2.3 '
4242}
4343```
4444
@@ -62,7 +62,7 @@ rxCache = new RxCache.Builder()
6262调用示例:
6363``` java
6464gankApi. getHistoryGank(1 )
65- .compose(rxCache. < GankBean > transformer(" custom_key" , strategy))
65+ .compose(rxCache. < GankBean > transformer(" custom_key" , GankBean . class, strategy))
6666 .subscribeOn(Schedulers . io())
6767 .observeOn(AndroidSchedulers . mainThread())
6868 .subscribe(new Subscriber<CacheResult<GankBean > > () {
@@ -88,6 +88,17 @@ gankApi.getHistoryGank(1)
8888 });
8989
9090```
91-
91+ 泛型:
92+ ``` java
93+ gankApi. getHistoryGank(1 )
94+ .map(new Function<GankBean , List<GankBean . ResultsBean > >() {
95+ @Override
96+ public List<GankBean . ResultsBean > apply (@NonNull GankBean gankBean ) throws Exception {
97+ return gankBean. getResults();
98+ }
99+ })
100+ .compose(rxCache. < List<GankBean . ResultsBean >> transformer(" custom_key" , new TypeToken<List<GankBean . ResultsBean > >() {}. getType(), strategy))
101+ ...
102+ ```
92103
93104
You can’t perform that action at this time.
0 commit comments