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

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
z-chu committed Jun 1, 2017
1 parent f0fb9e4 commit 4198615
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
* **RxJava 2.0**
```groovy
dependencies {
compile 'com.zchu:rxcache:2.0.1'
compile 'com.zchu:rxcache:2.0.2'
}
```
* **RxJava 1.0**
```groovy
dependencies {
compile 'com.zchu:rxcache:1.2.1'
compile 'com.zchu:rxcache:1.2.3'
}
```

Expand All @@ -62,7 +62,7 @@ rxCache = new RxCache.Builder()
调用示例:
```java
gankApi.getHistoryGank(1)
.compose(rxCache.<GankBean>transformer("custom_key", strategy))
.compose(rxCache.<GankBean>transformer("custom_key", GankBean.class,strategy))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<CacheResult<GankBean>>() {
Expand All @@ -88,6 +88,17 @@ gankApi.getHistoryGank(1)
});

```

泛型:
```java
gankApi.getHistoryGank(1)
.map(new Function<GankBean, List<GankBean.ResultsBean>>() {
@Override
public List<GankBean.ResultsBean> apply(@NonNull GankBean gankBean) throws Exception {
return gankBean.getResults();
}
})
.compose(rxCache.<List<GankBean.ResultsBean>>transformer("custom_key", new TypeToken<List<GankBean.ResultsBean>>() {}.getType(), strategy))
...
```


0 comments on commit 4198615

Please sign in to comment.