Skip to content

Commit 61d1afe

Browse files
author
jiaolei
committed
update LruDiskCache
1 parent 7de7f31 commit 61d1afe

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

library/src/com/lidroid/xutils/cache/LruDiskCache.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,16 @@ public synchronized long getExpiryTimestamp(String key) throws IOException {
424424

425425
public File getCacheFile(String key, int index) {
426426
String diskKey = fileNameGenerator.generate(key);
427-
return new File(this.directory, diskKey + "." + index);
427+
File result = new File(this.directory, diskKey + "." + index);
428+
if (result.exists()) {
429+
return result;
430+
} else {
431+
try {
432+
this.remove(key);
433+
} catch (IOException ignore) {
434+
}
435+
return null;
436+
}
428437
}
429438

430439
public Snapshot get(String key) throws IOException {

0 commit comments

Comments
 (0)