mirror of
https://github.com/Qortal/qortal.git
synced 2025-07-22 20:26:50 +00:00
Added convenience method to make the code more readable.
This commit is contained in:
@@ -32,6 +32,10 @@ public class ArbitraryDataCache {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public boolean isCachedDataAvailable() {
|
||||
return !this.shouldInvalidate();
|
||||
}
|
||||
|
||||
public boolean shouldInvalidate() {
|
||||
try {
|
||||
// If the user has requested an overwrite, always invalidate the cache
|
||||
|
@@ -72,7 +72,7 @@ public class ArbitraryDataReader {
|
||||
// Not in the build queue - so check the cache itself
|
||||
ArbitraryDataCache cache = new ArbitraryDataCache(this.uncompressedPath, false,
|
||||
this.resourceId, this.resourceIdType, this.service);
|
||||
if (!cache.shouldInvalidate()) {
|
||||
if (cache.isCachedDataAvailable()) {
|
||||
this.filePath = this.uncompressedPath;
|
||||
return true;
|
||||
}
|
||||
@@ -111,7 +111,8 @@ public class ArbitraryDataReader {
|
||||
try {
|
||||
ArbitraryDataCache cache = new ArbitraryDataCache(this.uncompressedPath, overwrite,
|
||||
this.resourceId, this.resourceIdType, this.service);
|
||||
if (!cache.shouldInvalidate()) {
|
||||
if (cache.isCachedDataAvailable()) {
|
||||
// Use cached data
|
||||
this.filePath = this.uncompressedPath;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user