1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-27 04:22:07 +03:00

Allow access to the underlying DiskLruCache.

This is needed to implement public android APIs
android.net.HttpResponseCache.{flush,size,maxSize,close}
as well android.net.HttpResponseCache.install.

install needs to inspect the underlying DiskLruCache because
it promises not to install a new cache if the file directory and
size are the same as the old cache.
This commit is contained in:
Narayan Kamath
2013-06-12 09:55:45 +01:00
parent e401cacc5f
commit 76eaa1b1bf

View File

@@ -331,6 +331,30 @@ public final class HttpResponseCache extends ResponseCache {
return writeSuccessCount;
}
public long getSize() {
return cache.size();
}
public long getMaxSize() {
return cache.getMaxSize();
}
public void flush() throws IOException {
cache.flush();
}
public void close() throws IOException {
cache.close();
}
public File getDirectory() {
return cache.getDirectory();
}
public boolean isClosed() {
return cache.isClosed();
}
private synchronized void trackResponse(ResponseSource source) {
requestCount++;