tezvyn:

Configure OkHttp Cache for Retrofit and force network requests

Source: square.github.ioadvanced

This tests HTTP caching semantics in mobile networking. A strong answer covers Cache setup with a 50 MiB directory, server Cache-Control driving expiration, and CacheControl.FORCE_NETWORK to bypass.

This tests your grasp of HTTP caching as a client-server contract rather than a Retrofit feature. A strong answer details configuring an OkHttpClient with a 50 MiB Cache directory, wiring that client into Retrofit, explaining how server Cache-Control headers dictate expiration and validation behavior, and using CacheControl.FORCE_NETWORK on the request to skip the cache. Red flag: believing Retrofit manages its own cache, or failing to mention that responses must be fully read or closed before OkHttp will write them to disk.

Read the original → square.github.io

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Configure OkHttp Cache for Retrofit and force network requests · Tezvyn