Commit fb99c264 by olly Committed by Oliver Woodman

Implement CacheContentIndex storage switching

This change enables transitioning to/from different Storage
implementations, to allow experimentally enabling (and if
necessary, disabling) SQLiteStorage. All that's left to do
is the final wiring to turn it on

PiperOrigin-RevId: 232304458
parent f1ded9c3
...@@ -157,6 +157,7 @@ public final class SimpleCache implements Cache { ...@@ -157,6 +157,7 @@ public final class SimpleCache implements Cache {
} catch (CacheException e) { } catch (CacheException e) {
Log.e(TAG, "Storing index file failed", e); Log.e(TAG, "Storing index file failed", e);
} finally { } finally {
index.release();
unlockFolder(cacheDir); unlockFolder(cacheDir);
released = true; released = true;
} }
......
...@@ -52,6 +52,11 @@ public final class AtomicFile { ...@@ -52,6 +52,11 @@ public final class AtomicFile {
backupName = new File(baseName.getPath() + ".bak"); backupName = new File(baseName.getPath() + ".bak");
} }
/** Whether the file or its backup exists. */
public boolean exists() {
return baseName.exists() || backupName.exists();
}
/** Delete the atomic file. This deletes both the base and backup files. */ /** Delete the atomic file. This deletes both the base and backup files. */
public void delete() { public void delete() {
baseName.delete(); baseName.delete();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment