Okhttp: Wiki page all about caching

Created on 19 Feb 2019  路  7Comments  路  Source: square/okhttp

Stuff like:

  • HTTP caching heuristics source?
  • what it means if cacheResponse() and networkResponse() are both non-null (issue #4539)
  • why you need to read the entire response before an entry is stored
  • the cache must not compete with other processes for the same directory
  • pruning the cache manually
documentation

Most helpful comment

Hi, anyone working on this issue?

All 7 comments

Hi, anyone working on this issue?

5525

5528

#

#

Also how to avoid network when there is a viable cache entry.

        // Use the cache without hitting the network first
        // 504 code indicates that the Cache is stale
        val preferCache = CacheControl.Builder()
            .onlyIfCached()
            .build()

Working on this in a draft PR.

https://github.com/square/okhttp/pull/6009/files

Was this page helpful?
0 / 5 - 0 ratings