Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Commit 4198615

Browse files
committed
update README.md
1 parent f0fb9e4 commit 4198615

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
* **RxJava 2.0**
3333
```groovy
3434
dependencies {
35-
compile 'com.zchu:rxcache:2.0.1'
35+
compile 'com.zchu:rxcache:2.0.2'
3636
}
3737
```
3838
* **RxJava 1.0**
3939
```groovy
4040
dependencies {
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
6464
gankApi.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

0 commit comments

Comments
 (0)