Skip to content

Commit

Permalink
optimize some code
Browse files Browse the repository at this point in the history
  • Loading branch information
YangSen-qn committed Oct 25, 2023
1 parent 21e3a11 commit 71e44cf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
13 changes: 11 additions & 2 deletions library/src/main/java/com/qiniu/android/common/AutoZone.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public final class AutoZone extends Zone {
private static final SingleFlight<SingleFlightValue> SingleFlight = new SingleFlight<>();

private static final Cache zoneCache = new Cache.Builder(ZonesInfo.class)
.setVersion("v1.0.0")
.setVersion("v1")
.builder();

//私有云可能改变ucServer
Expand Down Expand Up @@ -188,7 +188,16 @@ private String makeCacheKey(String akAndBucket) {
if (ucHosts == null || ucHosts.isEmpty()) {
return akAndBucket;
}
return UrlSafeBase64.encodeToString(ucHosts.get(0)+":"+akAndBucket);

StringBuilder hosts = new StringBuilder();
for (String host : ucHosts) {
if (host == null || host.isEmpty()) {
continue;
}
hosts.append(host).append(":");
}

return UrlSafeBase64.encodeToString(hosts+akAndBucket);
}

private RequestTransaction createUploadRequestTransaction(UpToken token) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class NetworkStatusManager {
private static final NetworkStatusManager networkStatusManager = new NetworkStatusManager();

private final Cache cache = new Cache.Builder(NetworkStatus.class)
.setVersion("v1.0.2")
.setVersion("v2")
.setFlushCount(10)
.builder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ class ServerConfigCache {
private static final String kServerUserConfigDiskKey = "ServerUserConfig";

private final Cache configCache = new Cache.Builder(ServerConfig.class)
.setVersion("v1.0.0")
.setVersion("v1")
.builder();
private final Cache userConfigCache = new Cache.Builder(ServerUserConfig.class)
.setVersion("v1.0.0")
.setVersion("v1")
.builder();
;

Expand Down

0 comments on commit 71e44cf

Please sign in to comment.