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

Commit

Permalink
Merge pull request #31 from pingerx/master
Browse files Browse the repository at this point in the history
添加同步获取缓存
  • Loading branch information
z-chu authored Feb 15, 2019
2 parents b9541ae + b013ec9 commit 1b58b1b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ public enum CacheTarget {
});
```

同步获取缓存:
```java
CacheResult<String> = rxCache.<String>loadSync("test_key1", String.class);
```



## 混淆配置
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.71'
ext.kotlin_version = '1.3.21'
repositories {
jcenter()
maven {
Expand All @@ -11,7 +11,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.0'

classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath "guru.stefma.bintrayrelease:bintrayrelease:1.1.1"
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#Tue Nov 06 15:49:27 CST 2018
#Fri Feb 15 13:36:39 SGT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
org.gradle.daemon=true
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
org.gradle.parallel=true
9 changes: 9 additions & 0 deletions rxcache/src/main/java/com/zchu/rxcache/RxCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ public Publisher<CacheResult<T>> apply(Flowable<T> flowable) {
}


/**
* 同步读取缓存
* 会阻塞主线程,请在子线程调用
*/
public <T> CacheResult<T> loadSync(final String key, final Type type) {
return cacheCore.load(getMD5MessageDigest(key), type);
}


/**
* 读取
*/
Expand Down

0 comments on commit 1b58b1b

Please sign in to comment.