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:
@@ -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++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user